home *** CD-ROM | disk | FTP | other *** search
/ SGI Desktop Special Edition 1.1 / SGI Desktop Special Edition 1.1.iso / dist / patchSG0000721.idb / usr / include / sys / vo2.h.z / vo2.h
Encoding:
C/C++ Source or Header  |  1995-11-13  |  62.0 KB  |  1,855 lines

  1. #ifndef __VO2_H__
  2. #define __VO2_H__
  3.  
  4. /*
  5.  * vo2.h
  6.  *
  7.  *      headers/defines (internal, not shipped) for Sirius video board
  8.  *
  9.  * Copyright 1993, Silicon Graphics, Inc.
  10.  * All Rights Reserved.
  11.  *
  12.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  13.  * the contents of this file may not be disclosed to third parties, copied or
  14.  * duplicated in any form, in whole or in part, without the prior written
  15.  * permission of Silicon Graphics, Inc.
  16.  *
  17.  * RESTRICTED RIGHTS LEGEND:
  18.  * Use, duplication or disclosure by the Government is subject to restrictions
  19.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  20.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  21.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  22.  * rights reserved under the Copyright Laws of the United States.
  23.  */
  24. #include <sys/time.h>
  25. #define VO2_BOARDNAME        "Sirius"
  26. #define    VO2_VERSION_NUMBER    111
  27.  
  28. #define    VO2_BDREV_MINIMUM    3
  29. #define    VO2_BDREV_ADDED_XTALS    4
  30.  
  31. #define    VO2_SPL            spl5
  32.  
  33. /*
  34.  * Machine type
  35.  */
  36. #ifdef  IP5
  37. #define MPBUS
  38. #endif
  39. #ifdef  IP17
  40. #define MPBUS
  41. #endif
  42. #ifdef  IP19
  43. #define ONYX
  44. #endif
  45. #ifdef  IP21
  46. #define ONYX
  47. #endif
  48.  
  49. /*
  50.  * Directly accessible registers (on the VME bus)
  51.  */
  52.  
  53. #define    _VO2_BASE               0x0
  54.  
  55. #define    _VO2_ID_REG             (_VO2_BASE+0x00)
  56. #define    _VO2_VME_CMD            (_VO2_BASE+0x04)
  57. #define    _VO2_CNTRL              (_VO2_BASE+0x08)
  58. #define    _VO2_DMA_BLKSIZ         (_VO2_BASE+0x0C)
  59. #define    _VO2_INT_STAT           (_VO2_BASE+0x10)
  60. #define    _VO2_INT_MASK           (_VO2_BASE+0x14)
  61. #define    _VO2_INT_MODE        (_VO2_BASE+0x18)
  62. #define    _VO2_LOC_ADDR        (_VO2_BASE+0x1C)
  63. #define    _VO2_LOC_DATA        (_VO2_BASE+0x20)
  64. #define    _VO2_XILINX_CNTRL    (_VO2_BASE+0x24)
  65. #define    _VO2_XILINX_DATA    (_VO2_BASE+0x28)
  66. #define    _VO2_JTAG_MAIN        (_VO2_BASE+0x2C)
  67. /*
  68.  * _VO2_JTAG_PAB occupies bits [1..0] of _VO2_BASE+0x30;
  69.  * _VO2_VLAN_ADDR occupies bits [3..2] of _VO2_BASE+0x30.
  70.  */
  71. #define    _VO2_JTAG_PAB        (_VO2_BASE+0x30)
  72. #define    _VO2_VLAN_ADDR        (_VO2_BASE+0x30)
  73. #define    _VO2_VLAN_DATA        (_VO2_BASE+0x34)
  74.  
  75. /*
  76.  * The VLAN controller is accessed by reading and writing the
  77.  * _VO2_VLAN_DATA register.  The data read from that location is
  78.  * one of the three possible _VO2_VLAN_ADDR locations:
  79.  *
  80.  * (a) _VO2_VLAN_DATA_TX_RX    (the data transceiver, read/write 8 bits)
  81.  * (b) _VO2_HOST_TO_VLAN_FLAG    (vlan busy flag; cleared when vlan reads byte)
  82.  * (c) _VO2_VLAN_TO_HOST_FLAG    (host busy flag; cleared when host reads byte)
  83.  */
  84.  
  85. #define    _VO2_LAST_REG        _VO2_VLAN_DATA
  86.  
  87. #define _VO2_VLAN_DATA_TX_RX    (0x0 << 2)
  88. #define    _VO2_HOST_TO_VLAN_FLAG    (0x2 << 2)
  89. #define    _VO2_VLAN_TO_HOST_FLAG    (0x3 << 2)
  90.  
  91. #define _VO2_VLAN_BUSY        0x1
  92. #define _VO2_HOST_BUSY        0x1
  93.  
  94. #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
  95.  
  96. struct vo2_board {
  97.     volatile unsigned int id_reg;
  98.     volatile unsigned int vme_cmd;
  99.     volatile unsigned int cntrl;
  100.     volatile unsigned int dma_blksiz;
  101.     volatile unsigned int int_stat;
  102.     volatile unsigned int int_mask;
  103.     volatile unsigned int int_mode;
  104.     volatile unsigned int loc_addr;
  105.     volatile unsigned int loc_data;
  106.     volatile unsigned int xilinx_cntrl;
  107.     volatile unsigned int xilinx_data;
  108.     volatile unsigned int jtag_main;
  109.     volatile unsigned int jtag_pab;
  110. };
  111.  
  112. typedef struct vo2_board *vo2_board_t;
  113.  
  114. #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
  115.  
  116. /*
  117.  * What's in those registers
  118.  */
  119.  
  120. /* _VO2_ID_REG - ID register */
  121. #define    _VO2_ID_MASK        0x00ffffff
  122. #define    _VO2_ID_VALUE        0x00bcdef0
  123. #define    _VO2_HWREV_SHIFT    24
  124. #define    _VO2_HWREV_MASK        0x0f000000
  125.  
  126. /* _VO2_VME_CMD - VME command register (write only)
  127.  *    fifo of up to _VO2_VME_STK_SIZE words
  128.  *    first word: made from _VO2_VME_CMD0 parts
  129.  *    second word: host memory address (for all except _VO2_VME_CMD0_INT)
  130.  *    third word: see _VO2_LADDR_* below (all dma except _VO2_VME_CMD0_VID)
  131.  */
  132. #define    _VO2_VME_STK_SIZE    16
  133.  
  134. #define    _VO2_VME_CMD0_N_SHIFT    0
  135. #define    _VO2_VME_CMD0_N_MASK    0x00007fff
  136.  
  137. #define    _VO2_VME_CMD0_SHIFT    15
  138. #define    _VO2_VME_CMD0_MASK    0x00078000
  139.  
  140. #define    _VO2_VME_CMD0_NOP    0x00000000
  141. #define    _VO2_VME_CMD0_VID    0x00008000
  142. #define    _VO2_VME_CMD0_VLIST0    0x00010000
  143. #define    _VO2_VME_CMD0_VLIST1    0x00018000
  144. #define    _VO2_VME_CMD0_VLIST2    0x00020000
  145. #define    _VO2_VME_CMD0_VLIST3    0x00028000
  146. #define    _VO2_VME_CMD0_INT    0x00030000
  147. #define    _VO2_VME_CMD0_DMA    0x00038000
  148.  
  149. #define    _VO2_VME_CMD0_D32    0x00000000
  150. #define    _VO2_VME_CMD0_D64    0x00080000
  151. #define    _VO2_VME_CMD0_RD    0x00000000
  152. #define    _VO2_VME_CMD0_WR    0x00100000
  153.  
  154. #define    _VO2_VME_CMD0_BLK_SHIFT    21
  155. #define    _VO2_VME_CMD0_BLK_MASK    0xffe00000
  156.  
  157. /* _VO2_CNTRL - control (and status) register */
  158. #define    _VO2_RESET        0x00000001
  159. #define    _VO2_RESET_VLIST    0x00000002
  160. #define    _VO2_RESET_DMA        0x00000004
  161. #define    _VO2_DMA_ROR        0x00000000
  162. #define    _VO2_DMA_RWD        0x00000008
  163. #define    _VO2_JTAG_ENABLE    0x00000010
  164. #define    _VO2_VLIST_BUSY        0x00000020
  165. #define    _VO2_SD1_INSTALLED_L    0x00000040
  166. #define    _VO2_PAB_CTRL_L        0x00000080
  167. #define    _VO2_PAB_DATA_L        0x00000100
  168. #define    _VO2_CNTRL_UNUSED_9    0x00000200
  169. #define    _VO2_BOB_POWER_L    0x00000400
  170. #define    _VO2_BOB_CABLE_L    0x00000800
  171.  
  172. /* _VO2_DMA_BLKSIZ - mode register */
  173.  
  174. /* _VO2_INT_STAT - interrupt status register (read only) */
  175. /* _VO2_INT_MASK - interrupt mask register */
  176. #define    _VO2_INT_ANY        0xffffff80
  177. #define    _VO2_INT_FRMDRP_CP    0x00000080
  178. #define    _VO2_INT_FRMDRP_ALPHA    0x00000100
  179. #define    _VO2_INT_FRMREP_ALPHA    0x00000200
  180. #define    _VO2_INT_INT0        0x00000400
  181. #define    _VO2_INT_INT1        0x00000800
  182. #define    _VO2_INT_INT2        0x00001000
  183. #define    _VO2_INT_INT3        0x00002000
  184. #define    _VO2_INT_VLIST0        0x00004000
  185. #define    _VO2_INT_VLIST1        0x00008000
  186. #define    _VO2_INT_VLIST2        0x00010000
  187. #define    _VO2_INT_VLIST3        0x00020000
  188. #define    _VO2_INT_FRMDRP_A    0x00040000
  189. #define    _VO2_INT_FRMDRP_B    0x00080000
  190. #define    _VO2_INT_FRMREP_A    0x00100000
  191. #define    _VO2_INT_FRMREP_B    0x00200000
  192. #define    _VO2_INT_NOSYNC_D1_1    0x00400000
  193. #define    _VO2_INT_NOSYNC_D1_2    0x00800000
  194. #define    _VO2_INT_NOSYNC_VI    0x01000000
  195. #define    _VO2_INT_NOSYNC_VO    0x02000000
  196. #define    _VO2_INT_NOGEN_VI    0x04000000
  197. #define    _VO2_INT_NOGEN_VO    0x08000000
  198. #define    _VO2_INT_VLAN        0x10000000
  199. #define    _VO2_INT_GPI_2        0x20000000
  200. #define    _VO2_INT_GPI_1        0x40000000
  201. #define    _VO2_INT_VME_CNTRL    0x80000000
  202.  
  203. /* _VO2_INT_MODE - interrupt mode register */
  204. #define    _VO2_IACK_MASK        0x000000ff
  205. #define    _VO2_ILEV_MASK        0x00000300
  206. #define    _VO2_ILEV_SHIFT        8
  207. #define    _VO2_ILEV_MIN        4
  208. #define    _VO2_ILEV_MAX        7
  209.  
  210. /* _VO2_LOC_ADDR - local address register (vlist must be idle) */
  211. #define    _VO2_LADDR_MASK        0x0003ffff
  212. #define _VO2_LADDR_SHIFT    0
  213. #define    _VO2_LADDR_SPEED_FAST    0x00000000
  214. #define    _VO2_LADDR_SPEED_MEDF    0x00040000
  215. #define    _VO2_LADDR_SPEED_MEDS    0x00080000
  216. #define    _VO2_LADDR_SPEED_SLOW    0x000c0000
  217. #define    _VO2_LADDR_SPEED_MASK    0x000c0000
  218. #define    _VO2_LADDR_SPEED_SHIFT    18
  219. #define    _VO2_LADDR_INCR        0x00100000
  220.  
  221. /* _VO2_LOC_DATA - local data register (vlist must be idle) */
  222.  
  223. /* _VO2_XILINX_CNTRL - xilinx control register */
  224. #define    _VO2_XILINX_PGM        0x00000001
  225. #define    _VO2_XILINX_RD        0x00000002
  226. #define    _VO2_XILINX_DONE    0x00000004
  227.  
  228. /* _VO2_XILINX_DATA - xilinx data register */
  229. #define    _VO2_XILINX_DATA_MASK    0x00000001
  230.  
  231. /* _VO2_JTAG_MAIN - jtag control register for the VO2 scan chain*/
  232. /* _VO2_JTAG_PAB - jtag control register for the paddleboard scan chain*/
  233. #define    _VO2_JTAG_TDIO        0x00000001
  234. #define    _VO2_JTAG_TMS        0x00000002
  235.  
  236. /*
  237.  * end of directly accessible registers
  238.  */
  239.  
  240. /*
  241.  * vlist definitions
  242.  */
  243. #define    _VO2_VLIST_DATA_MASK    0x3fffffff
  244. #define    _VO2_VLIST_CMD_MASK    0xc0000000
  245. #define    _VO2_VLIST_WRDATA    0x00000000
  246. #define    _VO2_VLIST_WRADDR    0x40000000
  247. #define    _VO2_VLIST_WAIT_UNCOND    0x80000000
  248. #define    _VO2_VLIST_WAIT_COND    0x80100000
  249. #define    _VO2_VLIST_DONE        0xc0000000
  250.  
  251. #define    _VO2_VLIST_DEFAULT    0
  252.  
  253. #define    _VO2L_VLIST_0_SIZE    0x2400
  254. #define    _VO2L_VLIST_1_SIZE    0x2400
  255. #define    _VO2L_VLIST_2_SIZE    0x2400
  256. #define    _VO2L_VLIST_3_SIZE    0x1400
  257.  
  258. /*
  259.  * Local bus address definitions
  260.  */
  261. #define _VO2L_VLIST_0_RAM            (0x00000 |_VO2_LADDR_SPEED_SLOW)
  262. #define _VO2L_VLIST_1_RAM            (0x02400 |_VO2_LADDR_SPEED_SLOW)
  263. #define _VO2L_VLIST_2_RAM            (0x04800 |_VO2_LADDR_SPEED_SLOW)
  264. #define _VO2L_VLIST_3_RAM            (0x06c00 |_VO2_LADDR_SPEED_SLOW)
  265. #define _VO2L_D1_OUT_LUT_YUV            (0x08000 |_VO2_LADDR_SPEED_SLOW)
  266. #define _VO2L_D1_OUT_LUT_ALPHA            (0x0a000 |_VO2_LADDR_SPEED_SLOW)
  267. #define _VO2L_CKG_LUT                (0x0c000 |_VO2_LADDR_SPEED_SLOW)
  268. #define _VO2L_AOUT_LUT_YUV            (0x0e000 |_VO2_LADDR_SPEED_SLOW)
  269. #define _VO2L_AOUT_LUT_ALPHA            (0x10000 |_VO2_LADDR_SPEED_SLOW)
  270. #define _VO2L_VLIST_DUR0            (0x13400 |_VO2_LADDR_SPEED_SLOW)
  271. #define _VO2L_VLIST_DUR1            (0x13401 |_VO2_LADDR_SPEED_SLOW)
  272. #define _VO2L_VLIST_DUR2            (0x13402 |_VO2_LADDR_SPEED_SLOW)
  273. #define _VO2L_VLIST_VL0SEL            (0x13404 |_VO2_LADDR_SPEED_SLOW)
  274. #define _VO2L_VLIST_VL1SEL            (0x13405 |_VO2_LADDR_SPEED_SLOW)
  275. #define _VO2L_VLIST_VL2SEL            (0x13406 |_VO2_LADDR_SPEED_SLOW)
  276. #define _VO2L_VLIST_EN                (0x13407 |_VO2_LADDR_SPEED_SLOW)
  277. #define _VO2L_FBA_SRC_DST_SEL            (0x13800 |_VO2_LADDR_SPEED_SLOW)
  278. #define _VO2L_FBA_STATUS            (0x13801 |_VO2_LADDR_SPEED_SLOW)
  279. #define _VO2L_FBA_COMMAND            (0x13801 |_VO2_LADDR_SPEED_SLOW)
  280. #define _VO2L_FBA_UPPER_LEFT_VID_X        (0x13802 |_VO2_LADDR_SPEED_SLOW)
  281. #define _VO2L_FBA_UPPER_LEFT_Y            (0x13803 |_VO2_LADDR_SPEED_SLOW)
  282. #define _VO2L_FBA_PIX_PER_LIN            (0x13804 |_VO2_LADDR_SPEED_SLOW)
  283. #define _VO2L_FBA_LIN_PER_FLD            (0x13805 |_VO2_LADDR_SPEED_SLOW)
  284. #define _VO2L_FBA_UPPER_LEFT_ALP_X        (0x13806 |_VO2_LADDR_SPEED_SLOW)
  285. #define _VO2L_FBA_EAV_DELAY            (0x13807 |_VO2_LADDR_SPEED_SLOW)
  286. #define _VO2L_FBA_OVER_READ            (0x13808 |_VO2_LADDR_SPEED_SLOW)
  287. #define _VO2L_FBA_CLK_PLL_CTL_REG3        (0x13809 |_VO2_LADDR_SPEED_SLOW)
  288. #define _VO2L_FBA_OUT_PIPE_DLY            (0x1380a |_VO2_LADDR_SPEED_SLOW)
  289. #define _VO2L_FBA_FIELD_DOMINANCE        (0x1380b |_VO2_LADDR_SPEED_SLOW)
  290. #define _VO2L_FBA_CLK_PLL_CTL_REG1        (0x1380c |_VO2_LADDR_SPEED_SLOW)
  291. #define _VO2L_FBA_CLK_PLL_CTL_REG2        (0x1380d |_VO2_LADDR_SPEED_SLOW)
  292. #define _VO2L_FBB_SRC_DST_SEL            (0x13c00 |_VO2_LADDR_SPEED_SLOW)
  293. #define _VO2L_FBB_STATUS            (0x13c01 |_VO2_LADDR_SPEED_SLOW)
  294. #define _VO2L_FBB_COMMAND            (0x13c01 |_VO2_LADDR_SPEED_SLOW)
  295. #define _VO2L_FBB_UPPER_LEFT_VID_X        (0x13c02 |_VO2_LADDR_SPEED_SLOW)
  296. #define _VO2L_FBB_UPPER_LEFT_Y            (0x13c03 |_VO2_LADDR_SPEED_SLOW)
  297. #define _VO2L_FBB_PIX_PER_LIN            (0x13c04 |_VO2_LADDR_SPEED_SLOW)
  298. #define _VO2L_FBB_LIN_PER_FLD            (0x13c05 |_VO2_LADDR_SPEED_SLOW)
  299. #define _VO2L_FBB_UPPER_LEFT_ALP_X        (0x13c06 |_VO2_LADDR_SPEED_SLOW)
  300. #define _VO2L_FBB_EAV_DELAY            (0x13c07 |_VO2_LADDR_SPEED_SLOW)
  301. #define _VO2L_FBB_OVER_READ            (0x13c08 |_VO2_LADDR_SPEED_SLOW)
  302. #define _VO2L_FBB_CLK_PLL_CTL_REG3        (0x13c09 |_VO2_LADDR_SPEED_SLOW)
  303. #define _VO2L_FBB_OUT_PIPE_DLY            (0x13c0a |_VO2_LADDR_SPEED_SLOW)
  304. #define _VO2L_FBB_FIELD_DOMINANCE        (0x13c0b |_VO2_LADDR_SPEED_SLOW)
  305. #define _VO2L_FBB_CLK_PLL_CTL_REG1        (0x13c0c |_VO2_LADDR_SPEED_SLOW)
  306. #define _VO2L_FBB_CLK_PLL_CTL_REG2        (0x13c0d |_VO2_LADDR_SPEED_SLOW)
  307. #define _VO2L_FBA_ALPHA_SRC_DST_SEL        (0x14000 |_VO2_LADDR_SPEED_SLOW)
  308. #define _VO2L_FBA_ALPHA_STATUS            (0x14001 |_VO2_LADDR_SPEED_SLOW)
  309. #define _VO2L_FBA_ALPHA_COMMAND            (0x14001 |_VO2_LADDR_SPEED_SLOW)
  310. #define _VO2L_FBA_ALPHA_UPPER_LEFT_VID_X    (0x14002 |_VO2_LADDR_SPEED_SLOW)
  311. #define _VO2L_FBA_ALPHA_UPPER_LEFT_Y        (0x14003 |_VO2_LADDR_SPEED_SLOW)
  312. #define _VO2L_FBA_ALPHA_PIX_PER_LIN        (0x14004 |_VO2_LADDR_SPEED_SLOW)
  313. #define _VO2L_FBA_ALPHA_LIN_PER_FLD        (0x14005 |_VO2_LADDR_SPEED_SLOW)
  314. #define _VO2L_FBA_ALPHA_UPPER_LEFT_ALP_X    (0x14006 |_VO2_LADDR_SPEED_SLOW)
  315. #define _VO2L_FBA_ALPHA_EAV_DELAY        (0x14007 |_VO2_LADDR_SPEED_SLOW)
  316. #define _VO2L_FBA_ALPHA_OVER_READ        (0x14008 |_VO2_LADDR_SPEED_SLOW)
  317. #define _VO2L_FBA_ALPHA_CLK_PLL_CTL_REG3    (0x14009 |_VO2_LADDR_SPEED_SLOW)
  318. #define _VO2L_FBA_ALPHA_OUT_PIPE_DLY        (0x1400a |_VO2_LADDR_SPEED_SLOW)
  319. #define _VO2L_FBA_ALPHA_FIELD_DOMINANCE        (0x1400b |_VO2_LADDR_SPEED_SLOW)
  320. #define _VO2L_FBA_ALPHA_CLK_PLL_CTL_REG1    (0x1400c |_VO2_LADDR_SPEED_SLOW)
  321. #define _VO2L_FBA_ALPHA_CLK_PLL_CTL_REG2    (0x1400d |_VO2_LADDR_SPEED_SLOW)
  322. #define _VO2L_FBA_MATRIX_COEF            (0x14400 |_VO2_LADDR_SPEED_SLOW)
  323. #define _VO2L_FBB_MATRIX_COEF            (0x14800 |_VO2_LADDR_SPEED_SLOW)
  324. #define _VO2L_CKG_MATRIX_COEF            (0x14c00 |_VO2_LADDR_SPEED_SLOW)
  325. #define _VO2L_CP_MATRIX_COEF            (0x15000 |_VO2_LADDR_SPEED_SLOW)
  326. #define _VO2L_VIDOUT_MATRIX_COEF        (0x15400 |_VO2_LADDR_SPEED_SLOW)
  327. #define _VO2L_PACTL                (0x15800 |_VO2_LADDR_SPEED_SLOW)
  328. #define _VO2L_PACTL_MODE            (0x15800 |_VO2_LADDR_SPEED_SLOW)
  329. #define _VO2L_PACTL_HI_XSTART            (0x15801 |_VO2_LADDR_SPEED_SLOW)
  330. #define _VO2L_PACTL_HI_XPIXEL_LINE        (0x15802 |_VO2_LADDR_SPEED_SLOW)
  331. #define _VO2L_PACTL_HI_YSTART            (0x15803 |_VO2_LADDR_SPEED_SLOW)
  332. #define _VO2L_PACTL_HI_YLINES_FRAME        (0x15804 |_VO2_LADDR_SPEED_SLOW)
  333. #define _VO2L_PACTL_LO_XPIXEL_LINE        (0x15805 |_VO2_LADDR_SPEED_SLOW)
  334. #define _VO2L_PACTL_LO_YLINES_FIELD        (0x15806 |_VO2_LADDR_SPEED_SLOW)
  335. #define _VO2L_PACTL_CLOCK_CTL1            (0x15807 |_VO2_LADDR_SPEED_SLOW)
  336. #define _VO2L_PACTL_CLOCK_CTL2            (0x15808 |_VO2_LADDR_SPEED_SLOW)
  337. #define _VO2L_PACTL_HI_XYCLEAR            (0x15809 |_VO2_LADDR_SPEED_SLOW)
  338. #define _VO2L_PA_RGBA_DATA            (0x15c00 |_VO2_LADDR_SPEED_SLOW)
  339. #define _VO2L_PA_RGBA_ADDR            (0x15c01 |_VO2_LADDR_SPEED_SLOW)
  340. #define _VO2L_PA_RED_DATA            (0x16000 |_VO2_LADDR_SPEED_SLOW)
  341. #define _VO2L_PA_RED_ADDR            (0x16001 |_VO2_LADDR_SPEED_SLOW)
  342. #define _VO2L_PA_GREEN_DATA            (0x16400 |_VO2_LADDR_SPEED_SLOW)
  343. #define _VO2L_PA_GREEN_ADDR            (0x16401 |_VO2_LADDR_SPEED_SLOW)
  344. #define _VO2L_PA_BLUE_DATA            (0x16800 |_VO2_LADDR_SPEED_SLOW)
  345. #define _VO2L_PA_BLUE_ADDR            (0x16801 |_VO2_LADDR_SPEED_SLOW)
  346. #define _VO2L_PA_ALP_DATA            (0x16c00 |_VO2_LADDR_SPEED_SLOW)
  347. #define _VO2L_PA_ALP_ADDR            (0x16c01 |_VO2_LADDR_SPEED_SLOW)
  348. #define _VO2L_AP_RGBA_DATA            (0x17000 |_VO2_LADDR_SPEED_SLOW)
  349. #define _VO2L_AP_RGBA_ADDR            (0x17001 |_VO2_LADDR_SPEED_SLOW)
  350. #define _VO2L_AP_RG_DATA            (0x17400 |_VO2_LADDR_SPEED_SLOW)
  351. #define _VO2L_AP_RG_ADDR            (0x17401 |_VO2_LADDR_SPEED_SLOW)
  352. #define _VO2L_AP_BA_DATA            (0x17800 |_VO2_LADDR_SPEED_SLOW)
  353. #define _VO2L_AP_BA_ADDR            (0x17801 |_VO2_LADDR_SPEED_SLOW)
  354. #define _VO2L_AP_RED_DATA            (0x17c00 |_VO2_LADDR_SPEED_SLOW)
  355. #define _VO2L_AP_RED_ADDR            (0x17c01 |_VO2_LADDR_SPEED_SLOW)
  356. #define _VO2L_AP_GREEN_DATA            (0x18000 |_VO2_LADDR_SPEED_SLOW)
  357. #define _VO2L_AP_GREEN_ADDR            (0x18001 |_VO2_LADDR_SPEED_SLOW)
  358. #define _VO2L_AP_BLUE_DATA            (0x18400 |_VO2_LADDR_SPEED_SLOW)
  359. #define _VO2L_AP_BLUE_ADDR            (0x18401 |_VO2_LADDR_SPEED_SLOW)
  360. #define _VO2L_AP_ALP_DATA            (0x18800 |_VO2_LADDR_SPEED_SLOW)
  361. #define _VO2L_AP_ALP_ADDR            (0x18801 |_VO2_LADDR_SPEED_SLOW)
  362. #define _VO2L_DR_RGBA_DATA            (0x18c00 |_VO2_LADDR_SPEED_SLOW)
  363. #define _VO2L_DR_RGBA_ADDR            (0x18c01 |_VO2_LADDR_SPEED_SLOW)
  364. #define _VO2L_DR_RG_DATA            (0x19000 |_VO2_LADDR_SPEED_SLOW)
  365. #define _VO2L_DR_RG_ADDR            (0x19001 |_VO2_LADDR_SPEED_SLOW)
  366. #define _VO2L_DR_BA_DATA            (0x19400 |_VO2_LADDR_SPEED_SLOW)
  367. #define _VO2L_DR_BA_ADDR            (0x19401 |_VO2_LADDR_SPEED_SLOW)
  368. #define _VO2L_DR_RED_DATA            (0x19800 |_VO2_LADDR_SPEED_SLOW)
  369. #define _VO2L_DR_RED_ADDR            (0x19801 |_VO2_LADDR_SPEED_SLOW)
  370. #define _VO2L_DR_GREEN_DATA            (0x19c00 |_VO2_LADDR_SPEED_SLOW)
  371. #define _VO2L_DR_GREEN_ADDR            (0x19c01 |_VO2_LADDR_SPEED_SLOW)
  372. #define _VO2L_DR_BLUE_DATA            (0x1a000 |_VO2_LADDR_SPEED_SLOW)
  373. #define _VO2L_DR_BLUE_ADDR            (0x1a001 |_VO2_LADDR_SPEED_SLOW)
  374. #define _VO2L_DR_ALP_DATA            (0x1a400 |_VO2_LADDR_SPEED_SLOW)
  375. #define _VO2L_DR_ALP_ADDR            (0x1a401 |_VO2_LADDR_SPEED_SLOW)
  376. #define _VO2L_CP_CONTROLLER            (0x1a800 |_VO2_LADDR_SPEED_SLOW)
  377. #define _VO2L_CTL_REG1                (0x1ac00 |_VO2_LADDR_SPEED_SLOW)
  378. #define _VO2L_CTL_REG2                (0x1b000 |_VO2_LADDR_SPEED_SLOW)
  379. #define _VO2L_EEPROM_DEFUNCT            (0x1b400 |_VO2_LADDR_SPEED_SLOW)
  380. #define _VO2L_D1_1_CS                (0x1b400 |_VO2_LADDR_SPEED_SLOW)
  381. #define _VO2L_ENC_CTL_ADDR            (0x1b800 |_VO2_LADDR_SPEED_SLOW)
  382. #define _VO2L_ENC_LUT_ADDR            (0x1b801 |_VO2_LADDR_SPEED_SLOW)
  383. #define _VO2L_ENC_CTL_DATA            (0x1b802 |_VO2_LADDR_SPEED_SLOW)
  384. #define _VO2L_ENC_LUT_DATA            (0x1b803 |_VO2_LADDR_SPEED_SLOW)
  385. #define _VO2L_VLAN                (0x1bc00 |_VO2_LADDR_SPEED_SLOW)
  386. #define _VO2L_PAB_RD                (0x1c000 |_VO2_LADDR_SPEED_SLOW)
  387. #define _VO2L_ANLG_CTL_REG            (0x1c400 |_VO2_LADDR_SPEED_SLOW)
  388. #define _VO2L_CALDAC_A_LD            (0x1c800 |_VO2_LADDR_SPEED_SLOW)
  389. #define _VO2L_CALDAC_B_LD            (0x1cc00 |_VO2_LADDR_SPEED_SLOW)
  390. #define _VO2L_CALDAC                (0x1d000 |_VO2_LADDR_SPEED_SLOW)
  391. #define _VO2L_DEC_ADDR                (0x1d400 |_VO2_LADDR_SPEED_SLOW)
  392. #define _VO2L_DEC_DATA                (0x1d402 |_VO2_LADDR_SPEED_SLOW)
  393. #define _VO2L_GENIN_R0                (0x1d800 |_VO2_LADDR_SPEED_SLOW)
  394. #define _VO2L_GENIN_R1                (0x1d801 |_VO2_LADDR_SPEED_SLOW)
  395. #define _VO2L_GENIN_R2                (0x1d802 |_VO2_LADDR_SPEED_SLOW)
  396. #define _VO2L_GENIN_R3                (0x1d803 |_VO2_LADDR_SPEED_SLOW)
  397. #define _VO2L_GENIN_R4                (0x1d804 |_VO2_LADDR_SPEED_SLOW)
  398. #define _VO2L_GENOUT_R0                (0x1dc00 |_VO2_LADDR_SPEED_SLOW)
  399. #define _VO2L_GENOUT_R1                (0x1dc01 |_VO2_LADDR_SPEED_SLOW)
  400. #define _VO2L_GENOUT_R2                (0x1dc02 |_VO2_LADDR_SPEED_SLOW)
  401. #define _VO2L_GENOUT_R3                (0x1dc03 |_VO2_LADDR_SPEED_SLOW)
  402. #define _VO2L_GENOUT_R4                (0x1dc04 |_VO2_LADDR_SPEED_SLOW)
  403. #define _VO2L_GEN_ENC                (0x1e000 |_VO2_LADDR_SPEED_SLOW)
  404. #define _VO2L_GEN_ENC_LOAD            (0x1e001 |_VO2_LADDR_SPEED_SLOW)
  405. #define _VO2L_STATUS                (0x1e400 |_VO2_LADDR_SPEED_SLOW)
  406. #define _VO2L_D1_2_CS                (0x1e800 |_VO2_LADDR_SPEED_SLOW)
  407. #define _VO2L_VOF                (0x1ec00 |_VO2_LADDR_SPEED_SLOW)
  408. #define _VO2L_VL0INT                (0x1f000 |_VO2_LADDR_SPEED_SLOW)
  409. #define _VO2L_VL1INT                (0x1f400 |_VO2_LADDR_SPEED_SLOW)
  410. #define _VO2L_VL2INT                (0x1f800 |_VO2_LADDR_SPEED_SLOW)
  411. #define _VO2L_VL3INT                (0x1fc00 |_VO2_LADDR_SPEED_SLOW)
  412. #define _VO2L_XILINX_CCK            (0x20000 |_VO2_LADDR_SPEED_SLOW)
  413. #define _VO2L_CTL_REG3                (0x20400 |_VO2_LADDR_SPEED_SLOW)
  414. #define _VO2L_EEPROM                (0x20800 |_VO2_LADDR_SPEED_SLOW)
  415.  
  416. /*
  417.  * Control register bit definitions on the local bus
  418.  */
  419.  
  420. /*
  421.  * _VO2L_CTL_REG1
  422.  */
  423. #define    _VO2L_CTL_REG1_UNUSED_0        0x00000001
  424. #define    _VO2L_CTL_IN_CH2_PARALLEL    0x00000002
  425. #define    _VO2L_CTL_EN_BURST_LOCK_OUTCLK    0x00000004
  426. #define    _VO2L_CTL_IN_CH1_PARALLEL    0x00000008
  427. #define    _VO2L_CTL_4444_SEL_CS        0x00000010
  428. #define    _VO2L_CTL_REG1_UNUSED_5        0x00000020
  429. #define    _VO2L_CTL_SEL_FBA_VID_CLK0    0x00000040
  430. #define    _VO2L_CTL_SEL_FBA_VID_CLK1    0x00000080
  431. #define    _VO2L_CTL_SEL_FBA_VID_CLK2    0x00000100
  432. #define    _VO2L_CTL_SEL_FBA_ALP_CLK0    0x00000200
  433. #define    _VO2L_CTL_SEL_FBA_ALP_CLK1    0x00000400
  434. #define    _VO2L_CTL_SEL_FBA_ALP_CLK2    0x00000800
  435. #define    _VO2L_CTL_VDR_DELAY        0x00001000
  436. #define    _VO2L_CTL_SEL_FBB_CLK0        0x00002000
  437. #define    _VO2L_CTL_SEL_FBB_CLK1        0x00004000
  438. #define    _VO2L_CTL_SEL_FBB_CLK2        0x00008000
  439. #define    _VO2L_CTL_VIDOUT_MTX_BYP_DIG    0x00010000
  440. #define    _VO2L_CTL_VIDOUT_MTX_BYP_ANLG    0x00020000
  441. #define    _VO2L_CTL_VIDOUT_LUT_BANK1    0x00040000
  442. #define    _VO2L_CTL_VLAN_RESET_L        0x00080000
  443. #define    _VO2L_CTL_SEL_CKG_ALP_FBA    0x00100000
  444. #define    _VO2L_CTL_SEL_CKG_ALP_FBB    0x00200000
  445. #define    _VO2L_CTL_CKG_LUT_BANK1        0x00400000
  446. #define    _VO2L_CTL_VME_10BITS        0x00800000
  447. #define    _VO2L_CTL_VME_2PIXFER        0x01000000
  448. #define    _VO2L_CTL_VDR_OFFSET_SELECT    0x02000000
  449. #define    _VO2L_CTL_FBA_VID_CLK_TEST    0x04000000
  450. #define    _VO2L_CTL_FBA_ALP_CLK_TEST    0x08000000
  451. #define    _VO2L_CTL_FBB_CLK_TEST        0x10000000
  452. #define    _VO2L_CTL_OUT_CLK_TEST        0x20000000
  453.  
  454. /*
  455.  * _VO2L_CTL_REG1   mask defines. This defines the FBA/FBB/FBA_ALPHA
  456.  * clock bit masks.
  457.  */
  458. #define    _VO2L_CTL_SEL_FBA_VID_CLK    0x000001c0
  459. #define _VO2L_CTL_SEL_FBA_ALP_CLK    0x00000e00
  460. #define _VO2L_CTL_SEL_FBB_VID_CLK    0x0000e000
  461.  
  462. /*
  463.  * _VO2L_CTL_REG shift defines for input clock select
  464.  */
  465. #define _VO2L_CTL_SHIFT_4444_SEL    0x4
  466. #define    _VO2L_CTL_SHIFT_FBA_VID_CLK    0x6
  467. #define _VO2L_CTL_SHIFT_FBA_ALP_CLK    0x9
  468. #define _VO2L_CTL_SHIFT_FBB_VID_CLK    0xd 
  469.  
  470. /*
  471.  * _VO2L_CTL_REG1  Value defines.
  472.  */
  473. #define _VO2L_CTL_BURST_ON        0x04
  474. #define _VO2L_CTL_BURST_OFF        0x00
  475.  
  476. /*
  477.  * _VO2L_CTL_REG2
  478.  */
  479. #define    _VO2L_CTL_VIDOUT_FILT_BYP    0x00000001
  480. #define    _VO2L_CTL_VIDOUT_FILT_TCO    0x00000002
  481. #define    _VO2L_CTL_VIDOUT_FILT_RND0    0x00000004
  482. #define    _VO2L_CTL_VIDOUT_FILT_RND1    0x00000008
  483. #define    _VO2L_CTL_VIDOUT_FILT_RND2    0x00000010
  484. #define    _VO2L_CTL_FBA_VID_BC_PROG_L    0x00000020
  485. #define    _VO2L_CTL_FBA_ALP_PROG_L    0x00000040
  486. #define    _VO2L_CTL_FBB_BC_PROG_L        0x00000080
  487. #define    _VO2L_CTL_CF_PROG_L        0x00000100
  488. #define    _VO2L_CTL_CKG_PROG_L        0x00000200
  489. #define    _VO2L_CTL_FBA_CRX_PROG_L    0x00000400
  490. #define    _VO2L_CTL_FBB_CRX_PROG_L    0x00000800
  491. #define    _VO2L_CTL_D1_CH1_PROG_L        0x00001000
  492. #define    _VO2L_CTL_D1_CH2_PROG_L        0x00002000
  493. #define    _VO2L_CTL_D1_OUT_PROG_L        0x00004000
  494. #define    _VO2L_CTL_GENIN_PROG_L        0x00008000
  495. #define    _VO2L_CTL_GENOUT_PROG_L        0x00010000
  496. #define    _VO2L_CTL_PACTL_PROG_L        0x00020000
  497. #define    _VO2L_CTL_VDR_PROG_L        0x00040000
  498. #define    _VO2L_CTL_VOF_PROG_L        0x00080000
  499. #define    _VO2L_CTL_FBA_FILT_BYP        0x00100000
  500. #define    _VO2L_CTL_FBA_FILT_TCO        0x00200000
  501. #define    _VO2L_CTL_FBA_FILT_RND0        0x00400000
  502. #define    _VO2L_CTL_FBA_FILT_RND1        0x00800000
  503. #define    _VO2L_CTL_FBA_FILT_RND2        0x01000000
  504. #define    _VO2L_CTL_FBB_FILT_BYP        0x02000000
  505. #define    _VO2L_CTL_FBB_FILT_TCO        0x04000000
  506. #define    _VO2L_CTL_FBB_FILT_RND0        0x08000000
  507. #define    _VO2L_CTL_FBB_FILT_RND1        0x10000000
  508. #define    _VO2L_CTL_FBB_FILT_RND2        0x20000000
  509.  
  510. /*
  511.  * CTL_REG2 shift values
  512.  */
  513. #define _VO2L_CTL_SHIFT_VIDOUT_FILT    0
  514. #define _VO2L_CTL_SHIFT_FBA_FILT    20
  515. #define _VO2L_CTL_SHIFT_FBB_FILT    25
  516.  
  517. /*
  518.  * _VO2L_CTL_REG3. 
  519.  */
  520. #define    _VO2L_CTL_REG3_UNUSED_0        0x00000001
  521. #define _VO2L_CTL_FBA_CRX_SCK        0x00000002
  522. #define _VO2L_CTL_FBB_CRX_SCK        0x00000004
  523. /*
  524.  * <CTL1> <CTL0>    MODE
  525.  *   0      0        RGBA12
  526.  *   0      1        RGB5 Tex
  527.  *   1      0        RGBA4 Tex
  528.  *   1      1        RGBA8 Tex
  529.  */
  530. #define _VO2L_CTL_CP_CTL0        0x00000008
  531. #define _VO2L_CTL_CP_CTL1        0x00000010
  532. #define _VO2L_CTL_CP_CTL_F1_DOM        0x00000020
  533. #define _VO2L_CTL_CP_CTL_OFFSET        0x00000040
  534. #define _VO2L_CTL_CP_FIELDS        0x00000080
  535. #define _VO2L_CTL_CP_BRD_ID0        0x00000100
  536. #define _VO2L_CTL_CP_BRD_ID1        0x00000200
  537. #define _VO2L_CTL_GPI_CNTL_CH1_0    0x00000400
  538. #define _VO2L_CTL_GPI_CNTL_CH1_1    0x00000800
  539. #define _VO2L_CTL_GPI_CNTL_CH2_0    0x00001000
  540. #define _VO2L_CTL_GPI_CNTL_CH2_1    0x00002000
  541. #define _VO2L_CTL_ALPOUT_L0        0x00004000
  542. #define _VO2L_CTL_ALPOUT_L1        0x00008000
  543. #define _VO2L_CTL_ALPOUT_L2        0x00010000
  544. #define _VO2L_CTL_ALPOUT_L3        0x00020000
  545.  
  546. /*
  547.  * _VO2L_CTL_REG3   mask defines. 
  548.  */
  549. #define _VO2L_CTL_CP_CTL        0x00000018
  550. #define _VO2L_CTL_CP_BRD_ID        0x00000300
  551. #define _VO2L_CTL_GPI_CNTL_CH1        0x00000c00
  552. #define _VO2L_CTL_GPI_CNTL_CH2        0x00003000
  553. #define _VO2L_CTL_ALPOUT        0x0003c000
  554.  
  555. /*
  556.  * _VO2L_CTL_REG3   shift defines. 
  557.  */
  558. #define _VO2L_CTL_SHIFT_CP_CTL        0x3
  559. #define _VO2L_CTL_SHIFT_CP_BRD_ID    0x8
  560. #define _VO2L_CTL_SHIFT_GPI_CNTL_CH1    0xa
  561. #define _VO2L_CTL_SHIFT_GPI_CNTL_CH2    0xc
  562. #define _VO2L_CTL_SHIFT_ALPOUT        0xe
  563.  
  564. /*
  565.  * _VO2L_CTL_REG3_CP_CTL value defines... These values are pre-shifted.
  566.  */
  567. #define _VO2L_CP_RGBA_12_PIX        0x0
  568. #define    _VO2L_CP_RGB_5_TEX        0x8
  569. #define    _VO2L_CP_RGBA_4_TEX        0x10
  570. #define _VO2L_CP_RGBA_8_TEX        0x18
  571. #define _VO2L_CP_FRAME_MODE        0x0
  572. #define _VO2L_CP_FIELD_MODE        0x80
  573.  
  574. /*
  575.  * Input clock select values
  576.  */
  577. #define _VO2L_IN_CLKSEL_VME        0x0
  578. #define _VO2L_IN_CLKSEL_D1_1        0x1
  579. #define _VO2L_IN_CLKSEL_D1_2        0x2
  580. #define _VO2L_IN_CLKSEL_GENIN        0x3
  581. #define _VO2L_IN_CLKSEL_GENOUT_2X    0x4
  582. #define _VO2L_IN_CLKSEL_DECODER        0x5
  583. #define _VO2L_IN_CLKSEL_GFX        0x6
  584.  
  585. /*
  586.  * _VO2L_ANLG_CTL_REG register bit map definitions
  587.  */
  588. #define _VO2L_ANLG_IN_GEN_SYNC_0    0x00001
  589. #define _VO2L_ANLG_IN_GEN_SYNC_1    0x00002
  590. #define _VO2L_ANLG_IN_GEN_SYNC_2    0x00004
  591. #define _VO2L_ANLG_SYNC_300MV_EN    0x00008        /* genlock sync select */
  592. #define _VO2L_ANLG_GEN_300MV_EN        0x00010        /* genlock sync select values */
  593. #define _VO2L_ANLG_SYNC_OUT_300_EN    0x00020     /* this enables the output sync in the BOB*/
  594. #define _VO2L_ANLG_GENIN_SEL        0x00040
  595. #define _VO2L_ANLG_AD_UNUSED        0x00080
  596. #define _VO2L_ANLG_OUT_GEN_SYNC_0    0x00100
  597. #define _VO2L_ANLG_OUT_GEN_SYNC_1    0x00200    
  598. #define _VO2L_ANLG_OUT_GEN_SYNC_2    0x00400
  599. #define _VO2L_ANLG_UV_MODE        0x00800
  600. #define _VO2L_ANLG_UV_MODE_YGA        0x01000
  601. #define _VO2L_ANLG_SET_VLAN_CLK_0    0x04000
  602. #define _VO2L_ANLG_SET_VLAN_CLK_1    0x02000
  603. #define _VO2L_ANLG_SEL_OUT_CLK_2    0x08000
  604. #define    _VO2L_ANLG_SEL_OUT_CLK_1    0x10000
  605. #define _VO2L_ANLG_SEL_OUT_CLK_0    0x20000
  606. #define _VO2L_ANLG_SEL_VOF_CLK_1    0x40000
  607. #define _VO2L_ANLG_SEL_VOF_CLK_0    0x80000
  608.  
  609. /*
  610.  *  _VO2L_ANLG_CTL_REG mask definitons 
  611.  */
  612. #define _VO2L_ANLG_IN_GEN_SYNC        0x00007
  613. #define _VO2L_ANLG_OUT_GEN_SYNC        0x00700
  614. #define _VO2L_ANLG_SET_FIELD        0x06000
  615. #define _VO2L_ANLG_SEL_OUT_CLK        0x38000
  616. #define _VO2L_ANLG_SEL_VOF_CLK        0xc0000
  617.  
  618. /*
  619.  * _VO2L_ANLG_IN_GEN_SYNC values. Thse values are preshifted.
  620.  */
  621. #define _VO2L_ANLG_IN_GEN_SYNC_300MV    0x0
  622. #define _VO2L_ANLG_IN_GEN_SYNC_4V    0x1
  623. #define _VO2L_ANLG_IN_SYNC_GREEN    0x2
  624. #define _VO2L_ANLG_IN_SYNC_300MV    0x3
  625. #define _VO2L_ANLG_IN_SYNC_4V        0x4
  626. #define _VO2L_ANLG_IN_SYNC_COMP        0x5
  627. #define _VO2L_ANLG_IN_SYNC_YC        0x6
  628. #define _VO2L_ANLG_IN_GEN_SYNC_GND    0x7
  629.  
  630. /*
  631.  * _VO2L_ANLG_OUT_GEN_SYNC values. Thse values are preshifted.
  632.  */
  633. #define _VO2L_ANLG_OUT_GEN_SYNC_300MV        0x000 /*300 mv genlock sync */
  634. #define _VO2L_ANLG_OUT_GEN_SYNC_4V        0x100 /* 4V genlock sync */
  635. #define _VO2L_ANLG_OUT_SYNC_GREEN        0x200 /* Sync On Green */
  636. #define _VO2L_ANLG_OUT_SYNC_300MV        0x300 /* Sync 300mv */
  637. #define _VO2L_ANLG_OUT_SYNC_4V            0x400 /* SYNC 4V    */
  638. #define _VO2L_ANLG_OUT_SYNC_COMP        0x500 /* Composite In */
  639. #define _VO2L_ANLG_OUT_SYNC_YC            0x600 /* Y/C IN     */
  640. #define _VO2L_ANLG_OUT_SYNC_STND_ALN           0x700 /* standalone */
  641. /*
  642.  * _VO2L_ANLG_SEL_OUT_CLK Value defines. These values are pre shifted and pre 
  643.  * swizzled.
  644.  */
  645. #define _VO2L_ANLG_OUT_CLK_VME        0x00000
  646. #define _VO2L_ANLG_OUT_CLK_D1_2        0x08000
  647. #define _VO2L_ANLG_OUT_CLK_COMPOSITE    0x10000
  648. #define _VO2L_ANLG_OUT_CLK_GENOUT    0x20000
  649. #define _VO2L_ANLG_OUT_CLK_D1_1        0x30000
  650.  
  651. /*
  652.  * _VO2L_ANLG_SEL_VOF_CLK value defines. These values are pre shifted and pre 
  653.  * swizzled.
  654.  */
  655. #define _VO2L_ANLG_VOF_CLK_GENOUT    0x00000
  656. #define _VO2L_ANLG_VOF_CLK_D1_1        0x40000
  657. #define _VO2L_ANLG_VOF_CLK_COMPOSITE    0x80000
  658. #define _VO2L_ANLG_VOF_CLK_D1_2        0xc0000
  659.  
  660. #define    _VO2L_ACTL_UNUSED        0x00000001
  661.  
  662. /*
  663.  * _VO2L_STATUS
  664.  */
  665. #define    _VO2L_STAT_UNUSED_0        0x00000001
  666. #define    _VO2L_STAT_UNUSED_1        0x00000002
  667. #define    _VO2L_STAT_UNUSED_2        0x00000004
  668. #define    _VO2L_STAT_ENC_GEN_SYNC_VALID    0x00000008
  669. #define    _VO2L_STAT_ENC_INT_L        0x00000010
  670. #define    _VO2L_STAT_FBA_VID_BC_DONEP    0x00000020
  671. #define    _VO2L_STAT_FBA_ALP_DONEP    0x00000040
  672. #define    _VO2L_STAT_FBB_BC_DONEP        0x00000080
  673. #define    _VO2L_STAT_CP_DONEP        0x00000100
  674. #define    _VO2L_STAT_CKG_DONEP        0x00000200
  675. #define    _VO2L_STAT_FBA_CRX_DONEP    0x00000400
  676. #define    _VO2L_STAT_FBB_CRX_DONEP    0x00000800
  677. #define    _VO2L_STAT_D1_CH1_DONEP        0x00001000
  678. #define    _VO2L_STAT_D1_CH2_DONEP        0x00002000
  679. #define    _VO2L_STAT_D1_OUT_DONEP        0x00004000
  680. #define    _VO2L_STAT_GENIN_DONEP        0x00008000
  681. #define    _VO2L_STAT_GENOUT_DONEP        0x00010000
  682. #define    _VO2L_STAT_PACTL_DONEP        0x00020000
  683. #define    _VO2L_STAT_VDR_DONEP        0x00040000
  684. #define    _VO2L_STAT_VOF_DONEP        0x00080000
  685.  
  686. /*
  687.  * _VO2L_VOF
  688.  */
  689. #define    _VO2L_VOF_CNTRL            (_VO2L_VOF+0)
  690. #define    _VO2L_VOF_VERT_SEQ_COUNTER    (_VO2L_VOF+1)
  691. #define    _VO2L_VOF_LINE_TYPE_LUT        (_VO2L_VOF+2)
  692. #define    _VO2L_VOF_LINE_LENGTH_LOW    (_VO2L_VOF+3)
  693. #define    _VO2L_VOF_LINE_LENGTH_HIGH    (_VO2L_VOF+4)
  694. #define    _VO2L_VOF_LINE_DURATION        (_VO2L_VOF+5)
  695. #define    _VO2L_VOF_EDGE_MEMORY_ADDR    (_VO2L_VOF+6)
  696. #define    _VO2L_VOF_EDGE_MEMORY_DATA    (_VO2L_VOF+7)
  697.  
  698. /* VOF_CNTRL REGISTER value defines */
  699. #define    _VO2L_VOF_CNTRL_RUNSTOP        0x00000001
  700. #define    _VO2L_VOF_CNTRL_RUN        0x00000000
  701. #define    _VO2L_VOF_CNTRL_STOP        0x00000001
  702. #define    _VO2L_VOF_CNTRL_SETUPSYNC_0    0x00000002
  703. #define    _VO2L_VOF_CNTRL_TTLVIDLEV    0x00000004
  704. #define    _VO2L_VOF_CNTRL_TTLLEV        0x00000000
  705. #define    _VO2L_VOF_CNTRL_VIDLEV        0x00000004
  706. /*
  707.  * Bits 3 and 4 of the vof control register used to select delay values for
  708.  * analog 525, analog 625, and digital, but they were unused, because the VOF
  709.  * always set the clock delays to two for all formats (thus the bit setting
  710.  * didn't matter).  These bits have now been redefined:
  711.  *
  712.  * Bit 3 of the [7..0] numbered vof control register is now the analog
  713.  * blanking enable; when set, we will blank the video signal for the duration
  714.  * of the frame.  When clear, normal vertical/horizontal blanking ensues.
  715.  * This bit is provided so that users may turn off the incorrectly timed
  716.  * "monitor" signal when running digital output formats.
  717.  *
  718.  * Bit 4 is unused, and available for future expansion.
  719.  */
  720. #define    _VO2L_VOF_CNTRL_ANALOG_BLANK_EN    0x00000008
  721. #define    _VO2L_VOF_CNTRL_UNUSED_BIT4    0x00000010
  722.  
  723. #define _VO2L_VOF_CNTRL_LOCKMODE        0x00000020
  724. #define _VO2L_VOF_CNTRL_BURSTLOCK       0x00000020
  725. #define _VO2L_VOF_CNTRL_NONBURSTLOCK    0x00000000
  726. #define    _VO2L_VOF_CNTRL_EDGEMEM        0x00000040
  727. #define    _VO2L_VOF_CNTRL_EDGEMEM_LOW    0x00000000
  728. #define    _VO2L_VOF_CNTRL_EDGEMEM_HIGH    0x00000040
  729. #define    _VO2L_VOF_CNTRL_SETUPSYNC_1    0x00000080
  730. #define    _VO2L_VOF_CNTRL_SETUPSYNC    0x00000082
  731.  
  732. #define    _VO2L_VOF_CNTRL_SETUPSYNC_M0    0x00000000
  733. #define    _VO2L_VOF_CNTRL_SETUPSYNC_M1    0x00000002
  734. #define    _VO2L_VOF_CNTRL_SETUPSYNC_M2    0x00000080
  735. #define    _VO2L_VOF_CNTRL_SETUPSYNC_M3    0x00000082
  736.  
  737.  
  738. /*
  739.  * Digital pots (analog calibration)
  740.  */
  741. #define    _VO2_DPOT_OFF_AD_G_Y        1
  742. #define    _VO2_DPOT_GAIN_AD_G_Y        2
  743. #define    _VO2_DPOT_OFF_AD_B_U        3
  744. #define    _VO2_DPOT_GAIN_AD_B_U        4
  745. #define    _VO2_DPOT_OFF_AD_R_V        5
  746. #define    _VO2_DPOT_GAIN_AD_R_V        6
  747. #define    _VO2_DPOT_OFF_AD_ALP        7
  748. #define    _VO2_DPOT_GAIN_AD_ALP        8
  749. #define    _VO2_DPOT_GAIN_DA_G_Y        9
  750. #define    _VO2_DPOT_GAIN_DA_B_U        10
  751. #define    _VO2_DPOT_GAIN_DA_R_V        11
  752. #define    _VO2_DPOT_GAIN_DA_ALP        12
  753. #define    _VO2_DPOT_CLK_REF_FINE_P    13
  754. #define    _VO2_DPOT_UNUSED_1        14
  755. #define    _VO2_DPOT_UNUSED_2        15
  756. #define    _VO2_DPOT_UNUSED_3        16
  757.  
  758. /*
  759.  *  _VO2L_GENOUT_R2 register bit definitons.
  760.  */
  761. #define _VO2L_GENOUT_LINE_DELAY_HI    0x03
  762. #define _VO2L_GENOUT_PAL_SELECT        0x04
  763. #define _VO2L_GENOUT_D1_FLD_SEL        0x08
  764. #define _VO2L_GENOUT_VOF_RESET_DIS    0x10
  765. #define _VO2L_GENOUT_STND_ALN_DIS    0x20
  766. #define    _VO2L_GENOUT_COMP_IN_CLK_SEL    0xc0
  767.  
  768. /*
  769.  *  _VO2L_GENOUT_R3 register bit definitons.
  770.  */
  771. #define _VO2L_GENOUT_LINE_DELAY_LO    0xff
  772.  
  773. /* _VO2L_ENC registers   */
  774. #define _VO2L_ENC_CNTL_REG        0x00
  775. #define _VO2L_ENC_FMT_REG        0x01
  776. #define _VO2L_ENC_INTFC_REG        0x02
  777. #define _VO2L_ENC_TEST_REG        0x03
  778. #define _VO2L_ENC_KEY_REG        0x04
  779.  
  780. #define _VO2L_ENC_SY_REG        0x10
  781. #define _VO2L_ENC_BR_REG        0x11
  782. #define _VO2L_ENC_BU_REG        0x12
  783. #define _VO2L_ENC_CBP_REG        0x13
  784. #define _VO2L_ENC_XBP_REG        0x14
  785. #define _VO2L_ENC_VA_REG        0x15
  786. #define _VO2L_ENC_VB_REG        0x16
  787. #define _VO2L_ENC_VC_REG        0x17
  788. #define _VO2L_ENC_MSB_REG        0x18
  789.  
  790. #define _VO2L_ENC_FP_REG        0x19
  791. #define _VO2L_ENC_EL_REG        0x1a
  792. #define _VO2L_ENC_EH_REG        0x1b
  793. #define _VO2L_ENC_SL_REG        0x1c
  794. #define _VO2L_ENC_SH_REG        0x1d
  795. #define _VO2L_ENC_CBL_REG        0x1e
  796.  
  797. #define _VO2L_ENC_FREQL_REG        0x20
  798. #define _VO2L_ENC_FREQL3_REG        0x21
  799. #define _VO2L_ENC_FREQL2_REG        0x22
  800. #define _VO2L_ENC_FREQLM_REG        0x23
  801.  
  802.  
  803. #define _VO2L_ENC_SYSPHL_REG        0x24
  804. #define _VO2L_ENC_SYSPHM_REG        0x25
  805. #define _VO2L_ENC_BURPHL_REG        0x26
  806. #define _VO2L_ENC_BURPHM_REG        0x27
  807.  
  808. /*
  809.  *
  810.  */
  811. #define _VO2_ENC_GEN_HPHASE_MASK    0x1fff000
  812. #define _VO2_ENC_GEN_HPHASE_SHIFT    12
  813.  
  814. /*
  815.  * DECODER register map
  816.  */
  817. #define _VO2L_DEC_CR0_REG        0x00
  818. #define _VO2L_DEC_CR1_REG        0x01
  819. #define _VO2L_DEC_CR2_REG        0x02
  820. #define _VO2L_DEC_CR3_REG        0x03
  821. #define _VO2L_DEC_CR4_REG        0x04
  822. #define _VO2L_DEC_CR5_REG        0x05
  823. #define _VO2L_DEC_CR6_REG        0x06
  824. #define _VO2L_DEC_CR7_REG        0x07
  825. #define _VO2L_DEC_BRIGHT_REG        0x08
  826. #define _VO2L_DEC_CONT_REG        0x09
  827. #define _VO2L_DEC_SAT_REG        0x0a
  828. #define _VO2L_DEC_HUE_REG        0x0b
  829. #define _VO2L_DEC_HCLK_LO_REG           0x0c
  830. #define _VO2L_DEC_HCLK_HI_REG           0x0d
  831. #define _VO2L_DEC_HDLY_LO_REG           0x0e
  832. #define _VO2L_DEC_HDLY_HI_REG           0x0f
  833. #define _VO2L_DEC_PIX_LO_REG            0x10
  834. #define _VO2L_DEC_PIX_HI_REG            0x11
  835. #define _VO2L_DEC_VDLY_LO_REG           0x12
  836. #define _VO2L_DEC_VDLY_HI_REG           0x13
  837. #define _VO2L_DEC_LINES_LO_REG          0x14
  838. #define _VO2L_DEC_LINES_HI_REG          0x15
  839. #define _VO2L_DEC_P0_REG        0x16
  840. #define _VO2L_DEC_P1_REG        0x17
  841. #define _VO2L_DEC_P2_REG        0x18
  842. #define _VO2L_DEC_AGC_REG        0x19
  843. #define _VO2L_DEC_BURST_REG        0x1a
  844. #define _VO2L_DEC_SAMP_LO_REG        0x1b
  845. #define _VO2L_DEC_SAMP_HI_REG        0x1c
  846. #define _VO2L_DEC_POLARITY_REG        0x1d
  847. #define _VO2L_DEC_SW_RESET        0xff
  848.  
  849.  
  850. /*
  851.  * Lookup table sizes
  852.  */
  853. #define    _VO2_DIGITAL_LUT_SIZE    4096
  854. #define    _VO2_ANALOG_LUT_SIZE    4096
  855. #define    _VO2_PA_LUT_SIZE    1024
  856. #define _VO2_ENC_LUT_SIZE    256    /* encoder LUT size */
  857.  
  858. #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
  859.  
  860. /*
  861.  * Stuff returned to user on a GETBOARDINFO call
  862.  * Anything in here is public knowledge
  863.  */
  864. struct vo2_info {
  865.     struct vid_info        vid_info;
  866.     int            bdrev;
  867.     int            hascpi;
  868.     int            hasdgi;
  869.     int            hasbob;
  870.     int            hassd1;
  871.     int            gfxpipe;
  872.     int            pabrev;
  873. };
  874.  
  875. /*
  876.  * Our private one-per-board data structure
  877.  * The user can't get at any of this
  878.  */
  879. struct vo2_data {
  880.     struct vid_data        vid_data;
  881.     struct vo2_info        info;
  882.  
  883.     int            vmebus;
  884.     int            boardnum;
  885.     void            *baseaddr;
  886.     unsigned int        intmode;
  887.  
  888.     struct proc *        user_proc;
  889.  
  890.     /*
  891.      * A strict lock for VME-bus FIFO reads and writes.
  892.      * Also used for localaddr/localdata register.
  893.      */
  894.     lock_t            vmecmd_lock;
  895.  
  896.     /*
  897.      * A strict lock for the shadowing stuff.
  898.      */
  899.     lock_t            shadow_lock;
  900.  
  901. #define VO2_SEMA_DMA_0        0
  902. #define VO2_SEMA_DMA_1        1
  903. #define VO2_SEMA_MISC        2
  904. #define    VO2_SEMA_VLIST        3
  905. #define    VO2_SEMA_VLAN        4
  906. #define    VO2_TIMEOUT_VLIST    5
  907.  
  908.     sema_t            dma_int_sema[4];    /* sleep semaphores */
  909.     toid_t            dma_timeout[5];
  910.  
  911.     dmamap_t        *dmamap[4];        /* DMA maps */
  912. /*
  913.  * maximum size of video DMA (entries 0 and 1): 768 x 576 x 4 / 4096 = 432
  914.  * maximum size of general-purpose DMA (entry 2): 16Kbytes = 4 pages
  915.  * maximum size of vlist DMA (entry 3): 20Kbytes = 5 pages
  916.  */
  917. #define    VO2_VIDEO_DMA_BUFFER_PAGES    432
  918. #define    VO2_GP_DMA_BUFFER_PAGES        4
  919. #define    VO2_VLIST_DMA_BUFFER_PAGES    5
  920.     int            npages[4];        /* size of DMA maps */
  921.  
  922. #ifndef    USE_K2_SPACE
  923.     int            actpages;
  924.     unsigned int        *pagelist[2];
  925.     void            *kvaddr[2];        /* k2 addr */
  926. #endif    /* USE_K2_SPACE */
  927.  
  928.     sema_t            dma_video_sema;
  929.     unsigned int        *dma_video_kbuf[2];    /* non-Onyx only */
  930.     unsigned char        *dma_video_mapaddr[2];    /* non-Onyx only */
  931.  
  932.     sema_t            dma_misc_sema;
  933.     unsigned int        *dma_misc_kbuf;
  934.     unsigned char        *dma_misc_mapaddr;
  935.  
  936.     lock_t            vlist_lock;
  937.     sema_t            vlist_sema;
  938.     unsigned int        *dma_vlist_kbuf;
  939.     unsigned int        *dma_vlist_dmabuf;
  940.     unsigned char        *dma_vlist_mapaddr;
  941.     unsigned int        vlist_n;
  942.     unsigned int        vlist_max;
  943.     unsigned int        vlist_hiwater;
  944.     unsigned int        vlist_enable;
  945.     unsigned int        vlist_ticks;
  946.     toid_t            vlist_timeout;
  947.  
  948.     unsigned int        dmrb_inuse;
  949.     unsigned int        dmrb_key;    /* passed by user */
  950.     int            dmrb_aid;    /* attach id */
  951.     unsigned int        dmrb_nfields;
  952.     unsigned int        dmrb_fieldsize;
  953.     int            dmrb_buffer;
  954.  
  955.     int            dma_abort;
  956.     int            dma_trigger;
  957.     int            dma_xferStartNotify;
  958.     int            dma_xferStopNotify;
  959.  
  960.     sema_t            dmrb_callback_sema;
  961.  
  962.     sema_t            gpi_1_sema;
  963.     sema_t            gpi_2_sema;
  964.     sema_t            vlan_sema;
  965.  
  966.     struct pollhead        *ph;
  967.     lock_t            events_lock;
  968.     unsigned int        vo2eventmask;
  969.     unsigned int        vo2events;
  970.  
  971.     /*
  972.      * The vlan_watchdog variable is normally zero, but gets set to
  973.      * one by the vlan timeout routine, so that a spinning kernel 
  974.      * process can take appropriate action.
  975.      */
  976.     int            vlan_watchdog;
  977.  
  978.  
  979. #define    _VO2_H_NONE            0
  980. #define    _VO2_H_VME_CNTRL        1
  981. #define    _VO2_H_VME_INT_MASK        2
  982. #define    _VO2_H_CTL_REG1            3
  983. #define    _VO2_H_CTL_REG2            4
  984. #define    _VO2_H_CTL_REG3            5
  985. #define    _VO2_H_CTL_ANLG            6
  986. #define    _VO2_H_VOF_CNTRL        7
  987.  
  988. #define _VO2_H_PA_MODE_R        8
  989. #define _VO2_H_PA_MODE_G        9
  990. #define _VO2_H_PA_MODE_B        10
  991. #define _VO2_H_PA_MODE_A        11
  992. #define _VO2_H_PA_ABMODE_R        12
  993. #define _VO2_H_PA_ABMODE_G        13
  994. #define _VO2_H_PA_ABMODE_B        14
  995. #define _VO2_H_PA_ABMODE_A        15
  996. #define _VO2_H_PA_DRMODE_R        16
  997. #define _VO2_H_PA_DRMODE_G        17
  998. #define _VO2_H_PA_DRMODE_B        18
  999. #define _VO2_H_PA_DRMODE_A        19
  1000.  
  1001. #define _VO2_H_AP_MODE_R        20
  1002. #define _VO2_H_AP_MODE_G        21
  1003. #define _VO2_H_AP_MODE_B        22
  1004. #define _VO2_H_AP_MODE_A        23
  1005. #define _VO2_H_AP_ABMODE_R        24
  1006. #define _VO2_H_AP_ABMODE_G        25
  1007. #define _VO2_H_AP_ABMODE_B        26
  1008. #define _VO2_H_AP_ABMODE_A        27
  1009. #define _VO2_H_AP_DRMODE_R        28
  1010. #define _VO2_H_AP_DRMODE_G        29
  1011. #define _VO2_H_AP_DRMODE_B        30
  1012. #define _VO2_H_AP_DRMODE_A        31
  1013.  
  1014. #define _VO2_H_DR_MODE_R        32
  1015. #define _VO2_H_DR_MODE_G        33
  1016. #define _VO2_H_DR_MODE_B        34
  1017. #define _VO2_H_DR_MODE_A        35
  1018. #define _VO2_H_DR_ABMODE_R        36
  1019. #define _VO2_H_DR_ABMODE_G        37
  1020. #define _VO2_H_DR_ABMODE_B        38
  1021. #define _VO2_H_DR_ABMODE_A        39
  1022. #define _VO2_H_DR_DRMODE_R        40
  1023. #define _VO2_H_DR_DRMODE_G        41
  1024. #define _VO2_H_DR_DRMODE_B        42
  1025. #define _VO2_H_DR_DRMODE_A        43
  1026.  
  1027. #define    _VO2_H_FBA_SRC_DST        44
  1028. #define    _VO2_H_FBB_SRC_DST        45
  1029. #define    _VO2_H_FBA_A_SRC_DST        46
  1030.  
  1031. #define    _VO2_H_PACTL_MODE        47
  1032.  
  1033. #define    _VO2_H_FBA_COMMAND        48
  1034. #define    _VO2_H_FBB_COMMAND        49
  1035. #define    _VO2_H_FBA_ALPHA_COMMAND    50
  1036.  
  1037. #define    _VO2_H_FBA_CLK_PLL_CTL_REG1    51
  1038. #define    _VO2_H_FBB_CLK_PLL_CTL_REG1    52
  1039. #define    _VO2_H_FBA_ALPHA_CLK_PLL_CTL_REG1    53
  1040. #define    _VO2_H_GENOUT_R2        54
  1041. #define    _VO2_H_GENOUT_R3        55
  1042. #define    _VO2_H_D1_1            56
  1043. #define    _VO2_H_D1_2            57
  1044. #define    _VO2_H_FBA_CLK_PLL_CTL_REG2    58
  1045. #define    _VO2_H_FBB_CLK_PLL_CTL_REG2    59
  1046. #define    _VO2_H_FBA_ALPHA_CLK_PLL_CTL_REG2    60
  1047.  
  1048. /* the following are software-only shadows */
  1049. #define    _VO2_H_DONE_VIDINIT        100
  1050. #define    _VO2_H_FBA_FILTER_DELAY        101
  1051. #define    _VO2_H_FBB_FILTER_DELAY        102
  1052. #define    _VO2_H_FBA_COARSE_PHASE_X    103
  1053. #define    _VO2_H_FBB_COARSE_PHASE_X    104
  1054. #define    _VO2_H_FBA_ALPHA_CHROMA_DELAY    105
  1055. #define    _VO2_H_FBB_ALPHA_CHROMA_DELAY    106
  1056. #define    _VO2_H_FBA_ALPHA_COARSE_PHASE_X    107
  1057. #define    _VO2_H_FBB_ALPHA_COARSE_PHASE_X    108
  1058. #define    _VO2_H_FBA_INPUT_SOURCE        109
  1059. #define    _VO2_H_FBA_ALPHA_INPUT_SOURCE    110
  1060. #define    _VO2_H_FBB_INPUT_SOURCE        111
  1061. #define    _VO2_H_FBA_OUT_AP_DELAY        112
  1062. #define    _VO2_H_FBB_OUT_AP_DELAY        113
  1063. #define    _VO2_H_FBA_ALPHA_OUT_AP_DELAY    114
  1064. #define    _VO2_H_DIG_OUT_MATRIX_DELAY    115
  1065. #define    _VO2_H_ANLG_OUT_MATRIX_DELAY    116
  1066. #define    _VO2_H_OUTPUT_FILTER_DELAY    117
  1067. #define _VO2_H_VID_OUT_ANALOG        118
  1068. #define    _VO2_H_CURRENT_VOF        119
  1069. #define    _VO2_H_FBA_TIMING        120
  1070. #define    _VO2_H_FBA_ALPHA_TIMING        121
  1071. #define    _VO2_H_FBB_TIMING        122
  1072. #define    _VO2_H_VDR_OFFSETS        123
  1073. #define    _VO2_H_VDR_INPATH_PACKING    124
  1074. #define    _VO2_H_VDR_OUTPATH_PACKING    125
  1075. #define    _VO2_H_GENIN_SRC        126
  1076. #define    _VO2_H_GENOUT_SRC        127
  1077. #define    _VO2_H_BURST_LOCK        128
  1078. #define    _VO2_H_SYNC_LEVEL        129
  1079. #define    _VO2_H_GENSYNC_LEVEL        130
  1080. #define _VO2_H_OUTPUT_BLANK        131
  1081. #define _VO2_H_OUTPUT_4444        132
  1082. #define _VO2_H_OUTPUT_DELAY        133
  1083. #define _VO2_H_GENLOCK_CHIP_MSB        134
  1084. #define _VO2_H_GENLOCK_CHIP_LSB        135
  1085. #define _VO2_H_OUTPUT_HPHASE        136
  1086. #define _VO2_H_OUT_CLK_SRC        137
  1087. #define _VO2_H_ANALOG_OUT_CS        138
  1088. #define    _VO2_H_VDR_INPATH_XFERFRAMES    139
  1089. #define    _VO2_H_VDR_OUTPATH_XFERFRAMES    140
  1090. #define    _VO2_H_ANALOG_IN_COMPOSITE    141
  1091. #define    _VO2_H_VID_OUT_TIMING        142
  1092. #define    _VO2_H_FBA_FIELD_DOMINANCE    143
  1093.  
  1094. #define    _VO2_H_MAXSHADOW        150
  1095.     unsigned int        shadow[_VO2_H_MAXSHADOW + 1];
  1096.     unsigned int         seqNo;
  1097.     unsigned int         media_offset;
  1098.     unsigned int         image_offset;
  1099.     unsigned int         fieldwidth;
  1100.     unsigned int         fieldheight;
  1101.     struct timeval          lasttime;
  1102. };
  1103.  
  1104. #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
  1105.  
  1106. /*
  1107.  * Device driver IOCTLs
  1108.  */
  1109. #define VO2_GET_VERSION        (VID_PRIVATE_BASE + 0)
  1110. #define    VO2_GET_BOARD_INFO    (VID_PRIVATE_BASE + 1)
  1111. #define    VO2_W_VME        (VID_PRIVATE_BASE + 2)
  1112. #define    VO2_S_VME        (VID_PRIVATE_BASE + 3)
  1113. #define    VO2_R_VME        (VID_PRIVATE_BASE + 4)
  1114. #define    VO2_D_VME        (VID_PRIVATE_BASE + 5)
  1115. #define    VO2_W_LOC        (VID_PRIVATE_BASE + 6)
  1116. #define    VO2_S_LOC        (VID_PRIVATE_BASE + 7)
  1117. #define    VO2_R_LOC        (VID_PRIVATE_BASE + 8)
  1118. #define    VO2_D_LOC        (VID_PRIVATE_BASE + 9)
  1119. #define    VO2_W_LIND        (VID_PRIVATE_BASE + 10)
  1120. #define    VO2_S_LIND        (VID_PRIVATE_BASE + 11)
  1121. #define    VO2_R_LIND        (VID_PRIVATE_BASE + 12)
  1122. #define    VO2_D_LIND        (VID_PRIVATE_BASE + 13)
  1123. #define    VO2_W_N_LOC        (VID_PRIVATE_BASE + 14)
  1124. #define    VO2_R_N_LOC        (VID_PRIVATE_BASE + 15)
  1125. #define    VO2_D_N_LOC        (VID_PRIVATE_BASE + 16)
  1126. #define    VO2_W_N_LIND        (VID_PRIVATE_BASE + 17)
  1127. #define    VO2_R_N_LIND        (VID_PRIVATE_BASE + 18)
  1128. #define    VO2_D_N_LIND        (VID_PRIVATE_BASE + 19)
  1129. #define    VO2_SET_SHADOW        (VID_PRIVATE_BASE + 20)
  1130. #define    VO2_GET_SHADOW        (VID_PRIVATE_BASE + 21)
  1131. #define    VO2_SET_N_SHADOW    (VID_PRIVATE_BASE + 22)
  1132. #define    VO2_GET_N_SHADOW    (VID_PRIVATE_BASE + 23)
  1133. #define    VO2_W_XILINX        (VID_PRIVATE_BASE + 24)
  1134. #define    VO2_W_VOF        (VID_PRIVATE_BASE + 25)
  1135. #define    VO2_W_DMA        (VID_PRIVATE_BASE + 26)
  1136. #define    VO2_R_DMA        (VID_PRIVATE_BASE + 27)
  1137. #define    VO2_W_DMAVID        (VID_PRIVATE_BASE + 28)
  1138. #define    VO2_R_DMAVID        (VID_PRIVATE_BASE + 29)
  1139. #define    VO2_W_EEPROM        (VID_PRIVATE_BASE + 30)
  1140. #define    VO2_R_EEPROM        (VID_PRIVATE_BASE + 31)
  1141. #define    VO2_SLEEP_TRIGGER    (VID_PRIVATE_BASE + 32)
  1142. #define    VO2_DMRB_ATTACH        (VID_PRIVATE_BASE + 33)
  1143. #define    VO2_DMRB_DETACH        (VID_PRIVATE_BASE + 34)
  1144. #define    VO2_DMRB_READ        (VID_PRIVATE_BASE + 35)
  1145. #define    VO2_DMRB_WRITE        (VID_PRIVATE_BASE + 36)
  1146. #define    VO2_DMA_ABORT        (VID_PRIVATE_BASE + 37)
  1147. #define    VO2_DMA_TRIGGER        (VID_PRIVATE_BASE + 38)
  1148. #define    VO2_DMA_NOTIFY        (VID_PRIVATE_BASE + 39)
  1149. #define    VO2_GET_EVENTS        (VID_PRIVATE_BASE + 40)
  1150. #define    VO2_SET_EVENTMASK    (VID_PRIVATE_BASE + 41)
  1151. #define VO2_VLAN_DOWNLOAD    (VID_PRIVATE_BASE + 42)
  1152. #define VO2_VLAN_READ_BYTE    (VID_PRIVATE_BASE + 43)
  1153. #define VO2_VLAN_WRITE_BYTE    (VID_PRIVATE_BASE + 44)
  1154. #define    VO2_STOPSTART_VLIST    (VID_PRIVATE_BASE + 45)
  1155.  
  1156. #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
  1157.  
  1158. /*
  1159.  * Structure for writing/reading a register
  1160.  */
  1161. struct vo2_rw_reg {
  1162.     void *addr;            /* base address (VME or local), for all */
  1163.     void *adata;        /* address of data, for indirect fncs only */
  1164.     void *indaddr;        /* indirect address, for indirect fncs only */
  1165.     unsigned int mask;        /* mask, for set-bit fncs only */
  1166.     unsigned int val;        /* value, for single location fncs only */
  1167.     unsigned int *data;        /* pointer to data, for block fncs only */
  1168.     int n;            /* number of items, for block fncs only */
  1169. };
  1170.  
  1171. /*
  1172.  * Structure for programming a xilinx
  1173.  */
  1174. struct vo2_w_xilinx {
  1175.     int which;
  1176.     int nbytes;
  1177.     int nbits;
  1178.     int nframes;
  1179.     int bitsperframe;
  1180.     unsigned char *data;
  1181. };
  1182.  
  1183. /*
  1184.  * Structure for programming a vof
  1185.  */
  1186. struct vo2_w_vof {
  1187.     unsigned char *topdata;
  1188.     int topcnt;
  1189.     unsigned char *bodydata;
  1190.     int bodycnt;
  1191. };
  1192.  
  1193. /*
  1194.  * Structure for doing a DMA
  1195.  */
  1196. struct vo2_dma {
  1197.     unsigned char *memaddr;    /* IRIX memory address (virtual user space) */
  1198.     unsigned char *brdaddr;    /* vo2 board localbus address for normal xfer */
  1199.     unsigned int len;        /* #words; or #fields for a video transfer */
  1200.     unsigned int fieldsize;    /* #words/field for a video transfer */
  1201.     unsigned int buffer;    /* buffer on VO2: A-RGB, A-ALPHA, or B */
  1202.     unsigned int xferframes;    /* transfer frames (default is fields) */
  1203. };
  1204.  
  1205. /*
  1206.  * struct vo2_dmrb_args is the arg for the VO2_DMRB_ ioctls.
  1207.  */
  1208. struct vo2_dmrb_args {
  1209.     unsigned int dataDirection;    /* 0 -> (vid to mem), 1 -> (mem to vid) */
  1210.     unsigned int key;        /* dmrb key from user */
  1211.     unsigned int len;        /* #fields for a video transfer */
  1212.     unsigned int fieldsize;    /* #words/field for a video transfer */
  1213.     unsigned int fieldwidth;    /* width of the field */
  1214.     unsigned int fieldheight;   /* height of the field */
  1215.     unsigned int buffer;    /* buffer on VO2: A-RGB, A-ALPHA, or B */
  1216.     unsigned int xferframes;    /* transfer frames (default is fields) */
  1217.     unsigned int media_offset;  /* media offset in the info structure */
  1218.     unsigned int image_offset;  /* image offset in the info structure */
  1219. };
  1220.  
  1221. /* for dataDirection */
  1222. #define VO2_VID_TO_MEM        0
  1223. #define VO2_MEM_TO_VID        1
  1224.  
  1225. /* for buffer */
  1226. #define    VO2_BUF_A_RGB        1
  1227. #define    VO2_BUF_A_ALPHA        2
  1228. #define    VO2_BUF_A_RGBA        3
  1229. #define    VO2_BUF_B_RGBA        4
  1230.  
  1231. /*
  1232.  * Structure which contains an integer value; we either take the least 
  1233.  * significant byte and write it to the VLAN, or return a byte read from 
  1234.  * the VLAN in the least significant byte.  If an error occurred during the
  1235.  * read, we will return EFAULT and set the byte equal to the return value
  1236.  * (0xffffff00).
  1237.  */
  1238. struct vo2_rw_vlan {
  1239.     int data;
  1240. };
  1241.  
  1242. #define VO2_VLAN_READBACK_AND_VERIFY    0x1
  1243. #define VO2_VLAN_ISSUE_GO_COMMAND    0x2
  1244.  
  1245. /*
  1246.  * Structure which contains the VLAN code to be downloaded.
  1247.  * Supply one or more flags to control the behavior of the downloaded code.
  1248.  *
  1249.  * For diags, we may want to download close to 32K worth of memory test data 
  1250.  * which can be read back by the prom with the VO2_VLAN_READBACK_AND_VERIFY
  1251.  * flag, but which should NOT executed as Z-80 code (i.e. don't provide the
  1252.  * VO2_VLAN_ISSUE_GO_COMMAND flag).  We cannot download a full 32K worth of 
  1253.  * data because a small amount of stack memory is needed by the Z-80 processor
  1254.  * at the top of SRAM (e.g. reserve maybe 200 bytes for Z-80 stack).
  1255.  */
  1256. struct vo2_w_vlan {
  1257.     unsigned char *data;
  1258.     int size;
  1259.     int flags;
  1260. };
  1261.  
  1262. /*
  1263.  * Structure which specifies which GPI outputs should map to the notify
  1264.  * events which could get issued at the start and finish of each dma transfer.
  1265.  */
  1266. struct vo2_dma_notify_args {
  1267.     int xferStartChannel;
  1268.     int xferStopChannel;
  1269. };
  1270.  
  1271. /*
  1272.  * Structure of the eeprom
  1273.  */
  1274. #define    VO2_EEPROM_SIZE        8192
  1275. #define    VO2_EEPROM_HEADER_SIZE    16
  1276. #define    VO2_EEPROM_ID        0x564F32
  1277. #define    VO2_EEPROM_REV        0x1
  1278.  
  1279. struct calib_entry {
  1280.     unsigned char in_green_y_offset;
  1281.     unsigned char in_green_y_gain;
  1282.     unsigned char in_blue_u_offset;
  1283.     unsigned char in_blue_u_gain;
  1284.     unsigned char in_red_v_offset;
  1285.     unsigned char in_red_v_gain;
  1286.     unsigned char in_alpha_offset;
  1287.     unsigned char in_alpha_gain;
  1288.     unsigned char out_green_y_gain;
  1289.     unsigned char out_blue_u_gain;
  1290.     unsigned char out_red_v_gain;
  1291.     unsigned char out_alpha_gain;
  1292. };
  1293.  
  1294. #define    _VO2_CALIB_FORMAT_RGB_WITH_SETUP    0
  1295. #define    _VO2_CALIB_FORMAT_RGB_WITHOUT_SETUP    1
  1296. #define    _VO2_CALIB_FORMAT_BETACAM        2
  1297. #define    _VO2_CALIB_FORMAT_MII            3
  1298. #define    _VO2_CALIB_FORMAT_SMPTE_YUV        4
  1299. #define _VO2_CALIB_FORMAT_N            5
  1300.  
  1301. #define _VO2_CALIB_TIMING_525            0
  1302. #define _VO2_CALIB_TIMING_625            1
  1303. #define    _VO2_CALIB_TIMING_N            2
  1304.  
  1305. struct vo2_eeprom {
  1306.     unsigned int prom_id;
  1307.     unsigned int prom_length;
  1308.     unsigned int prom_checksum;
  1309.     unsigned int prom_revision;
  1310.  
  1311.     /*
  1312.      * Diags section. Diags may always R/W this area. This area is not
  1313.      * included in the checksum calculations.
  1314.      */
  1315.     char diags_area[16];
  1316.  
  1317.     /*
  1318.      * Serial number section. Writable only by SGI. Should never be changed.
  1319.      */
  1320.     time_t t_serial_no;        /* time serial number recorded */
  1321.     char serial_no[8];        /* serial number */
  1322.     char serial_filler[980];    /* fill first 1024 bytes */
  1323.  
  1324.     /*
  1325.      * Factory calibration section. Writable only by SGI. Not used by
  1326.      * software other than to copy to user settings.
  1327.      */
  1328.     time_t t_factory_calib;    /* time of factory calibration */
  1329.     struct calib_entry factory_gain[_VO2_CALIB_FORMAT_N][_VO2_CALIB_TIMING_N];
  1330.     unsigned char factory_fineclock[_VO2_CALIB_TIMING_N];
  1331.     char factory_filler[898];    /* fill 1024 bytes */
  1332.  
  1333.     /*
  1334.      * User calibration section. Writeable by user. ONLY these values
  1335.      * should be used by software.
  1336.      */
  1337.     time_t t_user_calib;    /* time of user calibration */
  1338.     struct calib_entry user_gain[_VO2_CALIB_FORMAT_N][_VO2_CALIB_TIMING_N];
  1339.     unsigned char user_fineclock[_VO2_CALIB_TIMING_N];
  1340.     char user_filler[898];    /* fill 1024 bytes */
  1341.  
  1342.     /*
  1343.      * There are 5,120 bytes left.
  1344.      * We may wish to store a VOF???
  1345.      * Other user defaults? Dirty pictures? Laundry list??
  1346.      */
  1347. };
  1348.  
  1349. #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
  1350.  
  1351. /*
  1352.  * Defines for referring to a particular xilinx
  1353.  */
  1354. #define    _VO2_XILINX_VLC        0
  1355. #define    _VO2_XILINX_BC1        1
  1356. #define    _VO2_XILINX_BC2        2
  1357. #define    _VO2_XILINX_BC3        3
  1358. #define    _VO2_XILINX_CPF        4
  1359. #define    _VO2_XILINX_CKG        5
  1360. #define    _VO2_XILINX_CRX1    6
  1361. #define    _VO2_XILINX_CRX2    7
  1362. #define    _VO2_XILINX_D1IN1    8
  1363. #define    _VO2_XILINX_D1IN2    9
  1364. #define    _VO2_XILINX_D1OUT    10
  1365. #define    _VO2_XILINX_GIN        11
  1366. #define    _VO2_XILINX_GOUT    12
  1367. #define    _VO2_XILINX_PAC        13
  1368. #define    _VO2_XILINX_VDR        14
  1369. #define    _VO2_XILINX_VOF        15
  1370.  
  1371. /* 
  1372.  * PACTL mode register defines.
  1373.  */
  1374. #define _VO2L_PACTL_MODE_FILTER        0x003    /* Filter mode        */
  1375. #define _VO2L_PACTL_MODE_CM        0x004    /* Chip mode        */
  1376. #define _VO2L_PACTL_MODE_IN        0x008    /* DVI output format*/
  1377. #define _VO2L_PACTL_MODE_FR        0x010    /* Flicker reduction*/
  1378. #define _VO2L_PACTL_MODE_SF        0x020    /* Start field        */
  1379. #define _VO2L_PACTL_MODE_FM_LOCK    0x040    /* Top line flag    */
  1380. #define _VO2L_PACTL_MODE_FRAME        0x080    /* Frame ready flag */
  1381. #define _VO2L_PACTL_MODE_RESET        0x100    /* Reset 0,1,0         */
  1382. #define _VO2L_PACTL_MODE_WD        0x200    /* write disable    */
  1383. #define _VO2L_PACTL_MODE_FD        0x400    /* 1=625,0=525      */
  1384. /*
  1385.  * PACTL_INTERLACE    value
  1386.  */
  1387. #define _VO2_PACTL_HI_INTERLACE        0x01    /* hi res interlace format */
  1388. #define _VO2_PACTL_HI_INTER_SHIFT   0x03    
  1389. /*
  1390.  * PACTL_LO_XPIXEL_LINE masks .
  1391.  */
  1392. #define  _VO2L_PACTL_LO_XPIXEL_MASK 0x3ff   /* LOw res output pixels */
  1393. #define  _VO2L_PACTL_LO_XDEL_MASK   0xc00   /* X delay pixels         */
  1394.  
  1395. /*
  1396.  * PACTL_LO_XPIXEL_LINE Shift value
  1397.  */
  1398. #define  _VO2L_PACTL_LO_XDEL_SHIFT  0x0a    /* values for XDEL values */
  1399.  
  1400. /*
  1401.  * PACTL_HI_XYCLEAR masks
  1402.  */
  1403. #define  _VO2L_PACTL_HI_XCLEAR  0x03f       
  1404. #define  _VO2L_PACTL_HI_YCLEAR  0xfc0       
  1405. /*
  1406.  * PACTL_HI_XYCLEAR shifts
  1407.  */
  1408. #define  _VO2L_PACTL_HI_YCLEAR_SHIFT  0x6       
  1409.  
  1410. /*
  1411.  * _VO2L_PACTL_CLOCK_CTL1   register bits.
  1412.  */
  1413. #define _VO2L_PACTL_CLOCK_CTL1_1F0  0x003
  1414. #define _VO2L_PACTL_CLOCK_CTL1_1F1  0x00c
  1415. #define _VO2L_PACTL_CLOCK_CTL1_2F0  0x030
  1416. #define _VO2L_PACTL_CLOCK_CTL1_2F1  0x0c0
  1417. #define _VO2L_PACTL_CLOCK_CTL1_3F0  0x300
  1418. #define _VO2L_PACTL_CLOCK_CTL1_3F1  0xc00
  1419.  
  1420. /*
  1421.  * _VO2L_PACTL_CLOCK_CTL2   register bits.
  1422.  */
  1423. #define _VO2L_PACTL_CLOCK_CTL2_4F0    0x003
  1424. #define _VO2L_PACTL_CLOCK_CTL2_4F1    0x00c
  1425. #define _VO2L_PACTL_CLOCK_CTL2_TEST    0x030
  1426. #define _VO2L_PACTL_CLOCK_CTL2_FS    0x0c0
  1427. #define _VO2L_PACTL_CLOCK_CTL2_CLK_SEL    0x300
  1428.  
  1429. #define _VO2_PACTL_CLOCK_RATE_LOW    15000000
  1430. #define _VO2_PACTL_CLOCK_RATE_MEDIUM    25000000
  1431. #define _VO2_PACTL_CLOCK_RATE_SYNCH    30000000
  1432.  
  1433. #define _VO2_PACTL_CLOCK_SEL_LOW    0x010
  1434. #define _VO2_PACTL_CLOCK_SEL_MEDIUM    0x000
  1435. #define _VO2_PACTL_CLOCK_SEL_HIGH    0x080
  1436.  
  1437. #define _VO2L_PACTL_CLOCK_SEL_SYNCH    0x100
  1438.  
  1439. /*
  1440.  * Defines for the PA registers. Look at PA2 spec for details
  1441.  */
  1442. #define    _VO2_PA_MODE        0x000       
  1443. #define    _VO2_PA_ABMODE        0x001
  1444. #define    _VO2_PA_DRMODE        0x002
  1445. #define _VO2_PA_APMODE        0x002    /* In AP mode DRMODE becomes APMODE */
  1446. #define    _VO2_PA_HOR_COEF_0_1    0x003
  1447. #define    _VO2_PA_HOR_COEF_2_3    0x004
  1448. #define    _VO2_PA_HOR_COEF_4_5    0x005
  1449. #define    _VO2_PA_HOR_COEF_6_7    0x006
  1450. #define    _VO2_PA_HOR_COEF_8_9    0x007
  1451. #define    _VO2_PA_HOR_COEF_10    0x008
  1452. #define    _VO2_PA_NOR_COEF_1x2    0x009
  1453. #define    _VO2_PA_NOR_COEF_2x3    0x00a
  1454. #define    _VO2_PA_NOR_COEF_8x9    0x00b
  1455. #define    _VO2_PA_ZDF_COEF_1A    0x00c
  1456. #define    _VO2_PA_ZDF_COEF_2A    0x00d
  1457. #define    _VO2_PA_ZDF_COEF_3A    0x00e
  1458. #define    _VO2_PA_ZDF_COEF_4A    0x00f
  1459. #define    _VO2_PA_ZDF_COEF_5A    0x010
  1460. #define    _VO2_PA_ZDF_COEF_1B    0x011
  1461. #define    _VO2_PA_ZDF_COEF_2B    0x012
  1462. #define    _VO2_PA_ZDF_COEF_3B    0x013
  1463. #define    _VO2_PA_ZDF_COEF_4B    0x014
  1464. #define    _VO2_PA_ZDF_COEF_5B    0x015
  1465. #define    _VO2_PA_ZD_X_COMP    0x016
  1466. #define    _VO2_PA_ZD_Y_COMP    0x017
  1467. #define    _VO2_PA_ZD_X_CNT    0x018
  1468. #define    _VO2_PA_ZD_Y_CNT    0x019
  1469. #define    _VO2_PA_ZD_SEED        0x01a
  1470. #define    _VO2_PA_LOOKUP_TAB_MASK    0x3ff
  1471. #define    _VO2_PA_LOOKUP_TAB_DATA    0x400
  1472.  
  1473. /*
  1474.  * PA_MODE register Bit map.
  1475.  */
  1476. #define    _VO2_PA_MODE_FILTER    0x003    /* 3x3,2x2,Passthru filter */
  1477. #define    _VO2_PA_MODE_CM        0x004    /* Chip mode bit    */
  1478. #define    _VO2_PA_MODE_TA        0x008    /* Temporal averaging    */
  1479. #define    _VO2_PA_MODE_FR        0x010    /* Flicker Reduction    */
  1480. #define    _VO2_PA_MODE_TM        0x020    /* Test Mode        */
  1481. #define    _VO2_PA_MODE_BP        0x040    /* PA Bypass        */
  1482. #define    _VO2_PA_MODE_ZM        0x080    /* Zoom Mode        */
  1483. #define    _VO2_PA_MODE_XM        0x100    /* Zoom bit for X    */
  1484. #define    _VO2_PA_MODE_YM        0x200    /* Zoom bit for Y    */
  1485. #define    _VO2_PA_MODE_FC        0x400    /* Tap filter select    */
  1486. #define    _VO2_PA_MODE_RM        0x800    /* Rounding Control    */
  1487.  
  1488. /*
  1489.  * PA_ABMODE Register Bit map.
  1490.  */
  1491. #define    _VO2_PA_ABMODE_CS    0x001    /* Color Sign bit    */
  1492. #define _VO2_PA_ABMODE_AP    0x002    /* Alpha Proc mode    */
  1493. #define _VO2_PA_ABMODE_OE1    0x004    /* Output enable for port1*/
  1494. #define    _VO2_PA_ABMODE_OE2    0x008    /* Output enable for port2*/
  1495.  
  1496. /*
  1497.  * PA_DRMODE Register Bit map
  1498.  */
  1499. #define    _VO2_PA_DRMODE_FBA    0x007    /* Output1 mux select    */
  1500. #define    _VO2_PA_DRMODE_IN1    0x018    /* Input1 mux select    */
  1501. #define    _VO2_PA_DRMODE_S1    0x020    /* Sign select bit(Out1)*/
  1502. #define    _VO2_PA_DRMODE_FBB    0x1c0    /* Output2 mux select    */
  1503. #define    _VO2_PA_DRMODE_IN2    0x600    /* Input 1 Mux select    */
  1504. #define    _VO2_PA_DRMODE_S2    0x800    /* Sign select bit(Out2)*/
  1505.  
  1506. /*
  1507.  * PA_DRMODE value shift defines. For each of the above bit masks
  1508.  * these are the shift values that input data should be shifted by.
  1509.  */
  1510. #define    _VO2_PA_DR_SHIFT_FBA    0x0    
  1511. #define _VO2_PA_DR_SHIFT_IN1    0x3
  1512. #define _VO2_PA_DR_SHIFT_S1    0x5
  1513. #define _VO2_PA_DR_SHIFT_FBB    0x6
  1514. #define    _VO2_PA_DR_SHIFT_IN2    0x9
  1515. #define _VO2_PA_DR_SHIFT_S2    0xb
  1516.  
  1517. /*
  1518.  * PA_MODE_FILTER value defines. These values define the scan 
  1519.  * convert mode 
  1520.  */
  1521. #define    _VO2_PA_FILTER_2x2    0x0    /* 2x2 convolution filter*/
  1522. #define _VO2_PA_FILTER_3x3    0x1    /* 3x3 convolution filter*/
  1523. #define _VO2_PA_FILTER_3_5    0x2    /* 3/5 filter         */
  1524. #define    _VO2_PA_FILTER_PASS    0x3    /* Pass Thru         */
  1525.  
  1526.  
  1527. /*
  1528.  * PA_DRMODE_FBA/FBB value defines . These values define the bus that
  1529.  * is connected to output
  1530.  */
  1531. #define    _VO2_PA_DR_FB_VME    0x0    /* Input 1        */
  1532. #define    _VO2_PA_DR_FB_D1_1    0x1    /* Input 2        */
  1533. #define    _VO2_PA_DR_FB_D1_2    0x2    /* Input 3        */
  1534. #define    _VO2_PA_DR_FB_GFX    0x3    /* Input 4        */
  1535. #define    _VO2_PA_DR_FB_LUT    0x5    /* F2/F4 LUT output    */
  1536.  
  1537. /*
  1538.  * PA_DRMODE_IN1 value defines. These values specify the input bus
  1539.  * used as the address for F2 look up table.
  1540.  */
  1541. #define    _VO2_PA_DR_IN1_D1_1_CLK2    0x0    /*  Input 2 clocked at CLK2*/
  1542. #define    _VO2_PA_DR_IN1_D1_1        0x1    /*  Input 2        */
  1543. #define    _VO2_PA_DR_IN1_D1_2        0x2    /*  Input 3        */
  1544. #define    _VO2_PA_DR_IN1_ANALOG        0x3    /*  Input 5        */
  1545.  
  1546. /*
  1547.  * PA_DRMODE_IN2 value defines. These values specify the input bus
  1548.  * used as the address for F2 look up table.
  1549.  */
  1550. #define    _VO2_PA_DR_IN2_D1_2_CLK2    0x0    /*  Input 3 clocked at CLK2*/
  1551. #define    _VO2_PA_DR_IN2_D1_1        0x1    /*  Input 2        */
  1552. #define    _VO2_PA_DR_IN2_D1_2        0x2    /*  Input 3        */
  1553. #define    _VO2_PA_DR_IN2_ANALOG        0x3    /*  Input 5        */
  1554.  
  1555. /*
  1556.  * BUffer controllers (FBA/FBB) SRC_DST select registers bit
  1557.  * maps.
  1558.  */
  1559. #define    _VO2_FB_SRC_SEL        0x07    /* Frame buffer src    */
  1560. #define _VO2_FB_DST_SEL        0x18    /* Frame buffer destination*/
  1561.  
  1562. /*
  1563.  *  PA_APMODE registerbit map 
  1564.  */
  1565. #define    _VO2_PA_AP_GFX    0x007    /* Output1 mux select    */
  1566. #define    _VO2_PA_AP_FBA    0x018    /* Input1 mux select    */
  1567. #define    _VO2_PA_AP_S1    0x020    /* Sign select bit(Out1)*/
  1568. #define    _VO2_PA_AP_VID    0x1c0    /* Output2 mux select    */
  1569. #define    _VO2_PA_AP_FBB    0x600    /* Input 1 Mux select    */
  1570. #define    _VO2_PA_AP_S2    0x800    /* Sign select bit(Out2)*/
  1571.  
  1572. /*
  1573.  * PA_DRMODE value shift defines. For each of the above bit masks
  1574.  * these are the shift values that input data should be shifted by.
  1575.  */
  1576. #define    _VO2_PA_AP_SHIFT_GFX    0x0    
  1577. #define _VO2_PA_AP_SHIFT_FBA    0x3
  1578. #define _VO2_PA_AP_SHIFT_S1    0x5
  1579. #define _VO2_PA_AP_SHIFT_VID    0x6
  1580. #define    _VO2_PA_AP_SHIFT_FBB    0x9
  1581. #define _VO2_PA_AP_SHIFT_S2    0xb
  1582.  
  1583. /*
  1584.  * PA_LOOKUP_TAB mask bits
  1585.  */
  1586. #define _VO2_PA_LOOKUP_ENA_F1    0x001
  1587. #define _VO2_PA_LOOKUP_ENA_F2    0x002
  1588. #define _VO2_PA_LOOKUP_ENA_F3    0x004
  1589. #define _VO2_PA_LOOKUP_ENA_F4    0x008
  1590. #define _VO2_PA_LOOKUP_ENA_OUT1    _VO2_PA_LOOKUP_ENA_F2
  1591. #define _VO2_PA_LOOKUP_ENA_OUT2    _VO2_PA_LOOKUP_ENA_F4
  1592.  
  1593. /*
  1594.  * FB_SRC_SEL value defines ???
  1595.  */
  1596. #define    _VO2_FB_SRC_D1_1    0x0    /*  D1 channel 1    */
  1597. #define    _VO2_FB_SRC_D1_2    0x1    /*  D2 channel 2    */
  1598. #define    _VO2_FB_SRC_ANALOG    0x2    /*  Analog        */
  1599. #define    _VO2_FB_SRC_COMPOSITE    0x3    /*  Composite        */
  1600. #define    _VO2_FB_SRC_FDBK    0x4    /*  Feedback        */
  1601. #define    _VO2_FB_SRC_NULL    0x5    /*  NULL        */
  1602. #define    _VO2_FB_SRC_GFX        0x6    /*  GFX            */
  1603. #define    _VO2_FB_SRC_VME        0x7    /*  VME            */
  1604.  
  1605. /*
  1606.  * FB_DST_DEL value defines (preshifted)      
  1607.  */
  1608. #define    _VO2_FB_DST_DIGITAL    0x00    /* Digital Video out */
  1609. #define _VO2_FB_DST_ANALOG    0x00    /* Analog output    */
  1610. #define _VO2_FB_DST_NULL    0x08    /* Point to nothing */
  1611. #define _VO2_FB_DST_GFX        0x10    /* GFX Output        */
  1612. #define _VO2_FB_DST_TEX        0x10    /* TEX Output        */
  1613. #define _VO2_FB_DST_VME        0x18    /* VME Output        */
  1614.  
  1615. /*
  1616.  *    FB_COMMAND register bits 
  1617.  */
  1618. #define _VO2_FB_COMMAND_OW        0x001
  1619. #define _VO2_FB_COMMAND_GPI_OUT_EN    0x002
  1620. #define _VO2_FB_COMMAND_GPI_OUT_1     0x004
  1621. #define _VO2_FB_COMMAND_GPI_OUT_2    0x008
  1622. #define _VO2_FB_COMMAND_FIELD_MODE    0x000
  1623. #define _VO2_FB_COMMAND_FRAME_MODE    0x010
  1624. #define _VO2_FB_COMMAND_UNUSED        0x020
  1625. #define _VO2_FB_COMMAND_W_RESET        0x040
  1626. #define _VO2_FB_COMMAND_R_RESET        0x080
  1627. #define _VO2_FB_COMMAND_LINE_OFFSET_BIT    0x100    /* 0 = 525 , 1 = 625 */
  1628. #define _VO2_FB_COMMAND_LINE_OFFSET_525    0x000    /* 0 = 525 , 1 = 625 */
  1629. #define _VO2_FB_COMMAND_LINE_OFFSET_625    0x100    /* 0 = 525 , 1 = 625 */
  1630. #define _VO2_FB_COMMAND_PACK_MODE    0x200
  1631. #define _VO2_FB_COMMAND_DIG_SEL        0x400    /* 0 = D1_1, 1 = D1_2 */
  1632. /*
  1633.  *      FB_COMMAND mask  
  1634.  */
  1635. #define _VO2_FB_COMMAND_RESET        0xc0
  1636. #define _VO2_FB_COMMAND_GPI_OUT        0x0c
  1637.  
  1638. /*
  1639.  * FIELD_DOMINANCE is a four bit register used to invert the odd/even signal
  1640.  * when doing input or output.  Fine grained control is provided for maximum
  1641.  * flexibility: for bits numbered <3..0>, we have the following:
  1642.  *
  1643.  * bit <0> inverts the even/odd signal used to derive video input field order;
  1644.  * bit <1> inverts the even/odd signal used to derive video output field order;
  1645.  * bit <2> inverts the even/odd signal used to determine when to reset for 
  1646.  *           video output;
  1647.  * bit <3> inverts the even/odd signal used to clock the VLAN controller.
  1648.  * (bits <2> and <3> should probably always match bit <1>).
  1649.  */
  1650. #define     _VO2_FIELD_DOM_INPUT        0x1
  1651. #define     _VO2_FIELD_DOM_OUTPUT        0x2
  1652. #define     _VO2_FIELD_DOM_TRIGGER_RESET    0x4
  1653. #define     _VO2_FIELD_DOM_VLAN_CLOCK        0x8
  1654.  
  1655. /*
  1656.  * FB_CLK_PLL_CTL_REG1 defines
  1657.  */
  1658. #define    _VO2_FB_IN_CLK_RANGE        0x001
  1659. #define    _VO2_FB_OUT_CLK_RANGE        0x002
  1660. #define    _VO2_FB_IN_CLK_DELAY        0x03c
  1661. #define    _VO2_FB_OUT_CLK_DELAY        0x3c0
  1662.  
  1663. #define    _VO2_FB_IN_CLK_LOW_RANGE    0x000    
  1664. #define    _VO2_FB_IN_CLK_HIGH_RANGE    0x001    
  1665. #define    _VO2_FB_OUT_CLK_LOW_RANGE    0x000    
  1666. #define    _VO2_FB_OUT_CLK_HIGH_RANGE    0x002    
  1667. #define _VO2_FB_IN_CLK_ADVANCE        0x018
  1668. #define _VO2_FB_OUT_CLK_ADVANCE        0x0c0
  1669.  
  1670. /*
  1671.  * FB_CLK_PLL_CTL_REG2 defines
  1672.  */
  1673. #define _VO2_IN_CLK_DIVIDE_BY_2    0x0
  1674. #define _VO2_IN_CLK_PASS    0xff
  1675.  
  1676. /*
  1677.  * FB_OUT_PIPE_DLY
  1678.  */
  1679. #define    _VO2_FB_OUT_PIPE_DLY_MAX    0xff
  1680.  
  1681. /*
  1682.  * PA_DRMODE in Alpha blend modes. These values define the bus that
  1683.  * is connected to output of the Alpha processor
  1684.  */
  1685. #define    _VO2_PA_AP_FBA_COLOR    0x0    /* Input 1        */
  1686. #define    _VO2_PA_AP_FBA_ALPHA    0x1    /* Input 2        */
  1687. #define    _VO2_PA_AP_FBB_ALPHA    0x2    /* Input 3        */
  1688. #define    _VO2_PA_AP_FBB_COLOR    0x3    /* Input 4        */
  1689. #define _VO2_PA_AP_BLEND_OUT    0x4    /* Alpha blend output    */
  1690. #define    _VO2_PA_DR_FB_LUT    0x5    /* F2/F4 LUT output    */
  1691.  
  1692. /*
  1693.  * VO2L_D1_1_CS & VO2L_D1_1_CS    register define
  1694.  */
  1695. #define    _VO2L_D1_4444_DLY_A_MASK 0x03    /* delay on link A */
  1696. #define    _VO2L_D1_4444_DLY_B_MASK 0x0c    /* delay on Link B */
  1697. #define _VO2L_D1_4444_ENABLE     0x10    /* 4444 enable     */
  1698. /*
  1699.  * VO2L_D1_1_CS values ...
  1700.  */
  1701. #define _VO2L_D1_4444_A_DLY_0_CLK   0x00
  1702. #define _VO2L_D1_4444_A_DLY_1_CLK   0x01
  1703. #define _VO2L_D1_4444_A_DLY_2_CLK   0x02
  1704. #define _VO2L_D1_4444_A_DLY_3_CLK   0x03
  1705.  
  1706. #define _VO2L_D1_4444_B_DLY_0_CLK   0x00
  1707. #define _VO2L_D1_4444_B_DLY_1_CLK   0x04
  1708. #define _VO2L_D1_4444_B_DLY_2_CLK   0x08
  1709. #define _VO2L_D1_4444_B_DLY_3_CLK   0x0c
  1710.  
  1711. /*
  1712.  * Sync Lock type values
  1713.  */
  1714. #define _VO2_SYNC_NONBURST_LOCK    0x0
  1715. #define _VO2_SYNC_BURST_LOCK    0x1
  1716.  
  1717. /*
  1718.  * Sync Level values
  1719.  */
  1720. #define _VO2_SYNC_LEVEL_1V    0x0
  1721. #define _VO2_SYNC_LEVEL_4V    0x1
  1722.  
  1723. /*
  1724.  * Genlock Sync select values
  1725.  */
  1726. #define _VO2_SYNC_D1_1        0x0
  1727. #define _VO2_SYNC_D1_2        0x1
  1728. #define _VO2_SYNC_HOUSE        0x2
  1729. #define _VO2_SYNC_COMPOSITE    0x3
  1730. #define _VO2_SYNC_COMPONENT    0x4
  1731. #define _VO2_SYNC_GREEN        0x5
  1732. #define _VO2_SYNC_YC        0x6
  1733. #define _VO2_SYNC_STANDALONE    0x7
  1734.  
  1735. /*
  1736.  * Delay values for inpath and outpath
  1737.  */
  1738. #define _VO2_INPUT_FIR_DELAY            35
  1739. #define _VO2_INPUT_FIR_BYPASS_DELAY        1
  1740. #define _VO2_VIDOUT_FIR_DELAY            34
  1741. #define _VO2_VIDOUT_FIR_BYPASS_DELAY        0
  1742. #define _VO2_MATRIX_DELAY            5
  1743. #define _VO2_OUTPUT_MATRIX_DELAY        6
  1744. #define _VO2_OUTPUT_MATRIX_BYPASS_DELAY        1
  1745. #define _VO2_OUTPUT_VDR_D1OUT_ALPHA_DELAY    31
  1746. #define _VO2_CKG_DELAY                15 /*not determined yet*/
  1747. #define _VO2_PA2_LUT_DELAY            3
  1748. #define _VO2_PA2_PASSTHROUGH_DELAY        2
  1749. #define _VO2_PA2_AP_DELAY            9
  1750. #define _VO2_EAV_DIGITAL_DELAY_525        110
  1751. #define _VO2_EAV_DIGITAL_DELAY_625        116
  1752. #define _VO2_EAV_ANALOG_DELAY_525        93
  1753. #define _VO2_EAV_ANALOG_DELAY_D1525        100
  1754. #define _VO2_EAV_ANALOG_DELAY_625        131
  1755. #define _VO2_EAV_ANALOG_DELAY_D1625        110
  1756. #define _VO2_DIG_SRC_DELAY            17
  1757. #define _VO2_ANLG_SRC_DELAY            15
  1758. #define _VO2_ANALOG525_UPPER_LEFT_X_VALUE    3
  1759. #define _VO2_GFX_SRC_DELAY            -1
  1760. #define _VO2_VME_SRC_DELAY_8            0
  1761. #define _VO2_VME_SRC_DELAY_10            1
  1762. #define _VO2_VME_SRC_DELAY_422_10        2
  1763. #define _VO2_VME_SRC_DELAY_422_8        -1
  1764. #define _VO2_OUTPUT_GFX_DELAY            1
  1765. #define _VO2_OUTPUT_TEX_DELAY            4
  1766. #define _VO2_OUTPUT_TEX8_DELAY            6
  1767. #define _VO2_OUTPUT_DIG_VIDEO_DELAY        56
  1768. #define _VO2_OUTPUT_ANLG_VIDEO_DELAY        52
  1769. #define _VO2_OUTPUT_VME_DELAY            3
  1770. #define _VO2_OUTPUT_VME_DELAY_422_8        4
  1771. #define _VO2_INPATH_CRX_DELAY                   4
  1772. #define _VO2_INPATH_CONSTANT_DELAY               (_VO2_MATRIX_DELAY+_VO2_INPATH_CRX_DELAY)
  1773. #define _VO2_INPATH_ALPHA_CONSTANT_DELAY        0
  1774. #define _VO2_INPATH_Y_525_DELAY            16
  1775. #define _VO2_INPATH_Y_625_DELAY            21
  1776. #define _VO2_COMPOSITE_INPATH_EAV_OFFSET    0
  1777. #define _VO2_COMPOSITE_INPATH_Y_OFFSET_525    0
  1778. #define _VO2_COMPOSITE_INPATH_Y_OFFSET_625    0
  1779. #define _VO2_DIGITAL_INPATH_Y_OFFSET_525    1
  1780. #define _VO2_DIGITAL_INPATH_Y_OFFSET_625    1
  1781.  
  1782.  
  1783. /* GENOUT DELAYS */
  1784. #define _VO2_LINE_DELAY_HI_525            0x2
  1785. #define _VO2_LINE_DELAY_HI_625            0x3
  1786. #define _VO2_LINE_DELAY_HI_D1525        0x3
  1787. #define _VO2_LINE_DELAY_HI_D1625        0x3
  1788.  
  1789. #define _VO2_LINE_DELAY_LO_525            0xfe
  1790. #define _VO2_LINE_DELAY_LO_625            0xa2
  1791. #define _VO2_LINE_DELAY_LO_D1525        0x4c
  1792. #define _VO2_LINE_DELAY_LO_D1625        0x52
  1793.  
  1794. #define    _VO2_COMP_IN_CLK_DIGITAL        0x00
  1795. #define    _VO2_COMP_IN_CLK_NTSC            0x80
  1796. #define    _VO2_COMP_IN_CLK_PAL            0xc0
  1797.  
  1798. /* VLAN modes (525 and 625) */
  1799.  
  1800. #define _VO2_VLAN_NOTRUNNING    0
  1801. #define _VO2_VLAN_525        1
  1802. #define _VO2_VLAN_625        2
  1803.  
  1804. #define _VO2_VLAN_READY        0
  1805. #define _VO2_VLAN_DEAD        1
  1806.  
  1807. /*
  1808.  * Events - these are accumulated in the vo2_data->events field
  1809.  *        (the bit field definitions match the interrupt mask's)
  1810.  */
  1811. #define    _VO2_EVENT_XFER_DONE    0x00000001    /* VLTransferComplete */
  1812. #define    _VO2_EVENT_XFER_FAIL    0x00000002    /* VLTransferFailed */
  1813. #define    _VO2_EVENT_STREAM_START    0x00000004    /* VLStreamStarted */
  1814. #define    _VO2_EVENT_STREAM_STOP    0x00000008    /* VLStreamStopped */
  1815.  
  1816. #define    _VO2_EVENT_VLAN_TIMEOUT    0x00000010    /* VLSequenceLost */
  1817. #define    _VO2_EVENT_DMA_TIMEOUT    0x00000020    /* VLSequenceLost */
  1818. #define    _VO2_EVENT_FRMDRP_CP    0x00000080    /* VLSequenceLost */
  1819.  
  1820. #define    _VO2_EVENT_FRMDRP_ALPHA    0x00000100    /* VLSequenceLost */
  1821. #define    _VO2_EVENT_FRMREP_ALPHA    0x00000200    /* VLSequenceLost */
  1822.  
  1823. #define    _VO2_EVENT_FRMDRP_A    0x00040000    /* VLSequenceLost */
  1824. #define    _VO2_EVENT_FRMDRP_B    0x00080000    /* VLSequenceLost */
  1825.  
  1826. #define    _VO2_EVENT_FRMREP_A    0x00100000    /* VLSequenceLost */
  1827. #define    _VO2_EVENT_FRMREP_B    0x00200000    /* VLSequenceLost */
  1828.  
  1829. #define    _VO2_EVENT_NOSYNC_D1_1    0x00400000    /* VLSyncLost */
  1830. #define    _VO2_EVENT_NOSYNC_D1_2    0x00800000    /* VLSyncLost */
  1831. #define    _VO2_EVENT_NOSYNC_VI    0x01000000    /* VLSyncLost */
  1832. #define    _VO2_EVENT_NOSYNC_VO    0x02000000    /* VLSyncLost */
  1833. #define    _VO2_EVENT_NOGEN_VI    0x04000000    /* VLSyncLost */
  1834. #define    _VO2_EVENT_NOGEN_VO    0x08000000    /* VLSyncLost */
  1835.  
  1836. #define    _VO2_EVENT_VME_CNTRL    0x80000000    /* No VL Event defined */
  1837.  
  1838.  
  1839. /*
  1840.  * Triggers; for VO2_DMA_TRIGGER ioctl
  1841.  */
  1842. #define    _VO2_TRIGGER_NONE    0
  1843. #define    _VO2_TRIGGER_GPI_1    1
  1844. #define    _VO2_TRIGGER_GPI_2    2
  1845. #define    _VO2_TRIGGER_VLAN    3
  1846.  
  1847. /* 
  1848.  * GPI output states
  1849.  */
  1850. #define _VO2_GPI_OUT_ON        0
  1851. #define _VO2_GPI_OUT_OFF    1
  1852.  
  1853.  
  1854. #endif /* !__VO2_H__ */
  1855.